hgext/mq.py
changeset 16065 8af9e08a094f
parent 16057 db4b0532dbf2
parent 16064 7e5a281a082c
child 16102 50682c07a8d0
--- 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):