hgext/mq.py
changeset 11717 a286a4ecbfeb
parent 11714 aae1dd12fce6
parent 11715 4f9dfb54c8b5
child 11730 7469ff872122
--- a/hgext/mq.py	Sat Jul 31 11:41:58 2010 +0900
+++ b/hgext/mq.py	Sat Jul 31 18:12:50 2010 -0500
@@ -1051,12 +1051,16 @@
                 self.check_localchanges(repo)
 
             if move:
-                try:
-                    index = self.series.index(patch, start)
-                    fullpatch = self.full_series[index]
-                    del self.full_series[index]
-                except ValueError:
-                    raise util.Abort(_("patch '%s' not found") % patch)
+                if not patch:
+                    raise  util.Abort(_("please specify the patch to move"))
+                for i, rpn in enumerate(self.full_series[start:]):
+                    # strip markers for patch guards
+                    if self.guard_re.split(rpn, 1)[0] == patch:
+                        break
+                index = start + i
+                assert index < len(self.full_series)
+                fullpatch = self.full_series[index]
+                del self.full_series[index]
                 self.full_series.insert(start, fullpatch)
                 self.parse_series()
                 self.series_dirty = 1