changeset 4409:28b7d949ef6a

Merge with crew-stable. HG: changed hgext/mq.py
author Patrick Mezard <pmezard@gmail.com>
date Mon, 07 May 2007 00:12:35 +0200
parents 1ef4445c6506 (current diff) f700ea2b0689 (diff)
children bbc97d419b16
files hgext/mq.py
diffstat 3 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Sun May 06 16:40:53 2007 +0200
+++ b/hgext/mq.py	Mon May 07 00:12:35 2007 +0200
@@ -1303,6 +1303,10 @@
         return 0
 
     def series_end(self, all_patches=False):
+        """If all_patches is False, return the index of the next pushable patch
+        in the series, or the series length. If all_patches is True, return the
+        index of the first patch past the last applied one.
+        """
         end = 0
         def next(start):
             if all_patches:
@@ -1589,7 +1593,7 @@
 def top(ui, repo, **opts):
     """print the name of the current patch"""
     q = repo.mq
-    t = q.series_end()
+    t = q.applied and q.series_end(True) or 0
     if t:
         return q.qseries(repo, start=t-1, length=1, status='A',
                          summary=opts.get('summary'))
--- a/tests/test-mq-guards	Sun May 06 16:40:53 2007 +0200
+++ b/tests/test-mq-guards	Mon May 07 00:12:35 2007 +0200
@@ -54,6 +54,8 @@
 
 echo % should skip c.patch
 hg qpush -a
+echo % should display b.patch
+hg qtop
 
 hg qguard -n c.patch
 echo % should push c.patch
--- a/tests/test-mq-guards.out	Sun May 06 16:40:53 2007 +0200
+++ b/tests/test-mq-guards.out	Mon May 07 00:12:35 2007 +0200
@@ -25,6 +25,8 @@
 applying b.patch
 skipping c.patch - guarded by '-a'
 Now at: b.patch
+% should display b.patch
+b.patch
 % should push c.patch
 applying c.patch
 Now at: c.patch