changeset 11365:c3d7daa0928e

mq: make 'qdelete <patchidx>' work again. This just backs out 1abd9442727c (a minor code cleanup that accidentally broke qdelete) and adds a test.
author Greg Ward <greg-hg@gerg.ca>
date Wed, 16 Jun 2010 22:00:02 -0400
parents 0044193a1c45
children 1765897fc497
files hgext/mq.py tests/test-mq-qdelete
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Tue Jun 15 19:49:56 2010 -0300
+++ b/hgext/mq.py	Wed Jun 16 22:00:02 2010 -0400
@@ -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:
--- a/tests/test-mq-qdelete	Tue Jun 15 19:49:56 2010 -0300
+++ b/tests/test-mq-qdelete	Wed Jun 16 22:00:02 2010 -0400
@@ -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