This patch fix the failure introduced in the preceding patch adding a test for
quilt series import. It has other safety guards around the same subject, as
quilt can have various "-p" options given to it, but only "-p0" is encoded in
the series file. So try to detect the potentially other failure modes.

Signed-off-by: Vincent Legoll <[email protected]>
---
 stgit/commands/imprt.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/stgit/commands/imprt.py b/stgit/commands/imprt.py
index 1b12f39..41d3090 100644
--- a/stgit/commands/imprt.py
+++ b/stgit/commands/imprt.py
@@ -243,6 +243,16 @@ def __import_series(filename, options):
         patch = re.sub('#.*$', '', line).strip()
         if not patch:
             continue
+        # Quilt can have "-p0", "-p1" or "-pab" patches stacked in the
+        # series but as strip level default to 1, only "-p0" can actually
+        # be found in the series file, the other ones are implicit
+        m = 
re.match(r'(?P<patchfilename>.*)\s+-p\s*(?P<striplevel>(\d+|ab)?)\s*$', patch)
+        options.strip = 1
+        if m:
+            patch = m.group('patchfilename')
+            if m.group('striplevel') != '0':
+                raise CmdException, "error importing quilt series, patch '%s' 
has unsupported strip level: '-p%s'" % (patch, m.group('striplevel'))
+            options.strip = 0
         patchfile = os.path.join(patchdir, patch)
         patch = __replace_slashes_with_dashes(patch);
 
-- 
2.1.4


_______________________________________________
stgit-users mailing list
[email protected]
https://mail.gna.org/listinfo/stgit-users

Reply via email to