hgext/mq.py
changeset 4406 f700ea2b0689
parent 4341 7ae02bce8de2
child 4409 28b7d949ef6a
child 4418 0532491f7476
--- a/hgext/mq.py	Sun May 06 18:19:25 2007 +0200
+++ b/hgext/mq.py	Sun May 06 23:44:18 2007 +0200
@@ -1264,6 +1264,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:
@@ -1547,7 +1551,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'))