mq: fix qnext when all remaining patches are guarded stable
authorPatrick Mezard <pmezard@gmail.com>
Fri, 03 Feb 2012 19:38:31 +0100
branchstable
changeset 16063 c36db39b3fee
parent 16058 3b9c18ed9985
child 16064 7e5a281a082c
mq: fix qnext when all remaining patches are guarded When all remaining patches are guarded, qnext used to return the last of the queue anyway.
hgext/mq.py
tests/test-mq-guards.t
tests/test-mq.t
--- a/hgext/mq.py	Fri Feb 03 19:23:13 2012 +0100
+++ b/hgext/mq.py	Fri Feb 03 19:38:31 2012 +0100
@@ -1757,9 +1757,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:
@@ -2205,7 +2205,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
--- a/tests/test-mq-guards.t	Fri Feb 03 19:23:13 2012 +0100
+++ b/tests/test-mq-guards.t	Fri Feb 03 19:38:31 2012 +0100
@@ -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
 
--- a/tests/test-mq.t	Fri Feb 03 19:23:13 2012 +0100
+++ b/tests/test-mq.t	Fri Feb 03 19:38:31 2012 +0100
@@ -72,7 +72,7 @@
    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
    qpush         push the next patch onto the stack