065e9fbdd64d

Add the topindex keyword from Justin Lebar.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 12 Jan 2011 20:47:22 -0500
parents 2817cac5f5d7
children 2cca772f7e3d
branches/tags (none)
files prompt.py

Changes

--- a/prompt.py	Tue Jul 06 18:41:51 2010 -0400
+++ b/prompt.py	Wed Jan 12 20:47:22 2011 -0500
@@ -157,7 +157,12 @@
         if _get_filter('quiet', g) and not len(q.series):
             return ''
 
-        if _get_filter('applied', g):
+        if _get_filter('topindex', g):
+            if len(q.applied):
+                out = str(len(q.applied) - 1)
+            else:
+                out = ''
+        elif _get_filter('applied', g):
             out = str(len(q.applied))
         elif _get_filter('unapplied', g):
             out = str(len(q.unapplied(repo)))
@@ -349,7 +354,8 @@
             '|(\|merge)'
             ')*': _node,
         'patch(?:'
-            '(\|applied)'
+            '(\|topindex)'
+            '|(\|applied)'
             '|(\|unapplied)'
             '|(\|count)'
             '|(\|quiet)'
@@ -496,6 +502,11 @@
      |count
          Display the number of patches in the queue.
 
+     |topindex
+         Display (zero-based) index of the topmost applied patch in the series
+         list (as displayed by :hg:`qtop -v`, or the empty string if no patch
+         is applied.
+
      |applied
          Display the number of currently applied patches in the queue.