Ignore comments and empty lines in series files
authorGuido Günther <agx@sigxcpu.org>
Tue, 9 Aug 2011 17:17:37 +0000 (19:17 +0200)
committerGuido Günther <agx@sigxcpu.org>
Tue, 9 Aug 2011 17:23:20 +0000 (19:23 +0200)
Closes; #637224

gbp/pq.py

index 429ceeac3b8b05f5893d62de3765a8a84d83b0ae..3a13643898e14e3a0a76ddfcb63b5d1b0e60f905 100644 (file)
--- a/gbp/pq.py
+++ b/gbp/pq.py
@@ -75,6 +75,9 @@ class PatchQueue(list):
          <gbp.pq.Patch path='./a' strip=1 >,
          <gbp.pq.Patch path='./a/b' topic='a' strip=2 >]
 
+        >>> PatchQueue._read_series(['# foo', 'a/b', '', '# bar'], '.')
+        [<gbp.pq.Patch path='./a/b' topic='a' >]
+
         @param series: series of patches in quilt format
         @type series: iterable of strings
         @param patch_dir: path prefix to prepend to each patch path
@@ -83,6 +86,11 @@ class PatchQueue(list):
 
         queue = PatchQueue()
         for line in series:
+            try:
+                if line[0] in [ '\n', '#' ]:
+                    continue
+            except IndexError:
+                continue # ignore empty lines
             queue.append(klass._parse_line(line, patch_dir))
         return queue