diff hgext/mq.py @ 16303:7ee8aa662937 stable

mq: fix qpush --move with comments in series file between applied patches The 'start' variable pointed to qtip in self.series, but it was used for indexing self.fullseries. When fullseries had holes and the patch was moved to self.fullseries[start] it would end up too early in self.series and it could thus not be found in self.series[start:] and it would crash. Now the 'fullstart' index in fullseries is found used instead.
author Mads Kiilerich <mads@kiilerich.com>
date Thu, 29 Mar 2012 00:35:00 +0200
parents 9518cb55c822
children 73f4e05287b4 c3aedd526d53
line wrap: on
line diff
--- a/hgext/mq.py	Wed Mar 28 19:24:13 2012 -0500
+++ b/hgext/mq.py	Thu Mar 29 00:35:00 2012 +0200
@@ -1200,15 +1200,19 @@
             if move:
                 if not patch:
                     raise util.Abort(_("please specify the patch to move"))
-                for i, rpn in enumerate(self.fullseries[start:]):
+                for fullstart, rpn in enumerate(self.fullseries):
+                    # strip markers for patch guards
+                    if self.guard_re.split(rpn, 1)[0] == self.series[start]:
+                        break
+                for i, rpn in enumerate(self.fullseries[fullstart:]):
                     # strip markers for patch guards
                     if self.guard_re.split(rpn, 1)[0] == patch:
                         break
-                index = start + i
+                index = fullstart + i
                 assert index < len(self.fullseries)
                 fullpatch = self.fullseries[index]
                 del self.fullseries[index]
-                self.fullseries.insert(start, fullpatch)
+                self.fullseries.insert(fullstart, fullpatch)
                 self.parseseries()
                 self.seriesdirty = True