[PATCH] mq: make 'qdelete <patchidx>' work again

Greg Ward greg-hg at gerg.ca
Wed Jun 16 21:06:48 CDT 2010


# HG changeset patch
# User Greg Ward <greg-hg at gerg.ca>
# Date 1276740002 14400
# Node ID 889b9c821af098e6db3754d5d8fd25268aa2965f
# Parent  7914628b4751a6f8d56e26711f347df8df46d588
mq: make 'qdelete <patchidx>' work again.

This just backs out 1abd9442727c (a minor code cleanup that
accidentally broke qdelete) and adds a test.

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -752,6 +752,7 @@
             raise util.Abort(_('qdelete requires at least one revision or '
                                'patch name'))
 
+        realpatches = []
         for patch in patches:
             patch = self.lookup(patch, strict=True)
             info = self.isapplied(patch)
@@ -759,8 +760,8 @@
                 raise util.Abort(_("cannot delete applied patch %s") % patch)
             if patch not in self.series:
                 raise util.Abort(_("patch %s not in series file") % patch)
+            realpatches.append(patch)
 
-        patches = list(patches)
         numrevs = 0
         if opts.get('rev'):
             if not self.applied:
@@ -769,10 +770,10 @@
             if len(revs) > 1 and revs[0] > revs[1]:
                 revs.reverse()
             revpatches = self._revpatches(repo, revs)
-            patches += revpatches
+            realpatches += revpatches
             numrevs = len(revpatches)
 
-        self._cleanup(patches, numrevs, opts.get('keep'))
+        self._cleanup(realpatches, numrevs, opts.get('keep'))
 
     def check_toppatch(self, repo):
         if self.applied:
diff --git a/tests/test-mq-qdelete b/tests/test-mq-qdelete
--- a/tests/test-mq-qdelete
+++ b/tests/test-mq-qdelete
@@ -21,7 +21,7 @@
 hg qseries
 ls .hg/patches
 hg qpop
-hg qdel -k b
+hg qdel -k 1
 ls .hg/patches
 hg qdel -r a
 hg qapplied


More information about the Mercurial-devel mailing list