[PATCH] mq: fix qpush --move for selected guarded patches

Gilles Moris gilles.moris at free.fr
Tue Jun 22 02:51:52 CDT 2010

# HG changeset patch
# User Gilles Moris <gilles.moris at free.fr>
# Date 1277192991 -7200
# Node ID 186047b0348c6d98a4c58a060039c3b1b4e7f828
# Parent  b9320626ff16cbf3e776bc53e346a117ac3d2f70
mq: fix qpush --move for selected guarded patches

In the case of guarded patch, the patch could not be found because the
full_series list contains also the guard value appended to each patch name.
As we already checked that the patch is pushable above in the code, we just
have to use the series list (which doesn't contains guard value) to get the
patch index.

diff -r b9320626ff16 -r 186047b0348c hgext/mq.py
--- a/hgext/mq.py	Thu Feb 12 22:55:51 2009 +0100
+++ b/hgext/mq.py	Tue Jun 22 09:49:51 2010 +0200
@@ -1046,10 +1046,12 @@
             if move:
-                    del self.full_series[self.full_series.index(patch, start)]
+                    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)
-                self.full_series.insert(start, patch)
+                self.full_series.insert(start, fullpatch)
                 self.series_dirty = 1

More information about the Mercurial-devel mailing list