--- a/hgext/mq.py Thu Feb 02 10:15:13 2012 +0100
+++ b/hgext/mq.py Fri Feb 03 15:45:13 2012 -0600
@@ -1758,9 +1758,9 @@
for i in xrange(start, len(self.series)):
p, reason = self.pushable(i)
if p:
- break
+ return i
self.explainpushable(i)
- return i
+ return len(self.series)
if self.applied:
p = self.applied[-1].name
try:
@@ -2206,7 +2206,7 @@
@command("qnext", seriesopts, _('hg qnext [-s]'))
def next(ui, repo, **opts):
- """print the name of the next patch
+ """print the name of the next pushable patch
Returns 0 on success."""
q = repo.mq
@@ -2218,7 +2218,7 @@
@command("qprev", seriesopts, _('hg qprev [-s]'))
def prev(ui, repo, **opts):
- """print the name of the previous patch
+ """print the name of the previous applied patch
Returns 0 on success."""
q = repo.mq
@@ -2229,7 +2229,8 @@
if not l:
ui.write(_("no patches applied\n"))
return 1
- q.qseries(repo, start=l - 2, length=1, status='A',
+ idx = q.series.index(q.applied[-2].name)
+ q.qseries(repo, start=idx, length=1, status='A',
summary=opts.get('summary'))
def setupheaderopts(ui, opts):
--- a/tests/test-mq-guards.t Thu Feb 02 10:15:13 2012 +0100
+++ b/tests/test-mq-guards.t Fri Feb 03 15:45:13 2012 -0600
@@ -107,6 +107,9 @@
applying b.patch
skipping c.patch - guarded by '-a'
now at: b.patch
+ $ hg qnext
+ all patches applied
+ [1]
should display b.patch
@@ -169,6 +172,8 @@
$ hg qpush -a
applying c.patch
now at: c.patch
+ $ hg qprev
+ b.patch
Used to be an issue with holes in the patch sequence
So, put one hole on the base and ask for topmost patch.
--- a/tests/test-mq.t Thu Feb 02 10:15:13 2012 +0100
+++ b/tests/test-mq.t Fri Feb 03 15:45:13 2012 -0600
@@ -72,9 +72,9 @@
qheader print the header of the topmost or specified patch
qimport import a patch
qnew create a new patch
- qnext print the name of the next patch
+ qnext print the name of the next pushable patch
qpop pop the current patch off the stack
- qprev print the name of the previous patch
+ qprev print the name of the previous applied patch
qpush push the next patch onto the stack
qqueue manage multiple patch queues
qrefresh update the current patch
@@ -1476,7 +1476,7 @@
Test that qfinish preserve phase when mq.secret=false
- $ sed -i'' $HGRCPATH -e 's/secret=true/secret=false/'
+ $ sed -i.bak -e 's/secret=true/secret=false/' $HGRCPATH
$ hg qfinish qbase
patch add-file2 finalized without changeset message
$ hg phase 'all()'