mq: make 'qdelete <patchidx>' work again.
authorGreg Ward <greg-hg@gerg.ca>
Wed, 16 Jun 2010 22:00:02 -0400
changeset 11365 c3d7daa0928e
parent 11364 0044193a1c45
child 11366 1765897fc497
mq: make 'qdelete <patchidx>' work again. This just backs out 1abd9442727c (a minor code cleanup that accidentally broke qdelete) and adds a test.
hgext/mq.py
tests/test-mq-qdelete
--- 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