mq: make 'qdelete <patchidx>' work again.
This just backs out 1abd9442727c (a minor code cleanup that
accidentally broke qdelete) and adds a test.
--- 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