Issue424: mq patch loses guard when qrenamed
authorMathieu Clabaut <mathieu.clabaut@gmail.com>
Sun, 19 Nov 2006 23:47:19 +0100
changeset 3685 193e9c6d1a6d
parent 3684 975c2469c316
child 3686 4308f4cdc07b
Issue424: mq patch loses guard when qrenamed
hgext/mq.py
tests/test-mq-guards
tests/test-mq-guards.out
--- a/hgext/mq.py	Sun Nov 19 16:32:36 2006 -0600
+++ b/hgext/mq.py	Sun Nov 19 23:47:19 2006 +0100
@@ -1794,7 +1794,8 @@
     if ui.verbose:
         ui.write('Renaming %s to %s\n' % (patch, name))
     i = q.find_series(patch)
-    q.full_series[i] = name
+    guards = q.guard_re.findall(q.full_series[i])
+    q.full_series[i] = name + ''.join([' #' + g for g in guards])
     q.parse_series()
     q.series_dirty = 1
 
--- a/tests/test-mq-guards	Sun Nov 19 16:32:36 2006 -0600
+++ b/tests/test-mq-guards	Sun Nov 19 23:47:19 2006 +0100
@@ -98,3 +98,12 @@
 hg qselect -s
 echo % should show c.patch
 hg qapplied
+
+hg qrename a.patch new.patch
+echo % should show :
+echo % new.patch: +1 +2 -3
+echo % b.patch: +2
+echo % c.patch: unguarded
+hg qguard -l
+
+
--- a/tests/test-mq-guards.out	Sun Nov 19 16:32:36 2006 -0600
+++ b/tests/test-mq-guards.out	Sun Nov 19 23:47:19 2006 +0100
@@ -82,3 +82,10 @@
 -3
 % should show c.patch
 c.patch
+% should show :
+% new.patch: +1 +2 -3
+% b.patch: +2
+% c.patch: unguarded
+new.patch: +1 +2 -3
+b.patch: +2
+c.patch: unguarded