summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-08-09 19:17:37 +0200
committerGuido Günther <agx@sigxcpu.org>2011-08-09 19:23:20 +0200
commita8789475a921a1bd87b43e6f30b8f3e8613c0fa7 (patch)
treea6e02497111ac39a237e5bbd624a2e5364e2a63a
parent2da9e9ef8c1a045ea5e93ea12b5ab2d60a4f8aff (diff)
Ignore comments and empty lines in series files
Closes; #637224
-rw-r--r--gbp/pq.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/gbp/pq.py b/gbp/pq.py
index 429ceea..3a13643 100644
--- 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