645406a4e1fb

Add the {queue} keyword.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 06 Jul 2010 18:38:38 -0400
parents 43b7fb82d9a0
children 2817cac5f5d7
branches/tags (none)
files docs/wiki/documentation/keywords/index.mdown prompt.py

Changes

diff -r 43b7fb82d9a0 -r 645406a4e1fb docs/wiki/documentation/keywords/index.mdown
--- a/docs/wiki/documentation/keywords/index.mdown	Mon Jul 05 14:50:51 2010 -0400
+++ b/docs/wiki/documentation/keywords/index.mdown	Tue Jul 06 18:38:38 2010 -0400
@@ -122,6 +122,9 @@
     :   Display STRING immediately after each unapplied patch.  Useful for
         resetting color codes.
 
+##queue##
+:   Display the name of the current MQ queue.
+
 ##rev##
 :   Display the repository-local changeset number of the current parent.
     
diff -r 43b7fb82d9a0 -r 645406a4e1fb prompt.py
--- a/prompt.py	Mon Jul 05 14:50:51 2010 -0400
+++ b/prompt.py	Tue Jul 06 18:38:38 2010 -0400
@@ -311,6 +311,23 @@
                 return ''
         return _r
 
+    def _queue(m):
+        g = m.groups()
+
+        try:
+            extensions.find('mq')
+        except KeyError:
+            return ''
+
+        q = repo.mq
+
+        out = os.path.basename(q.path)
+        if out == 'patches' and not os.path.isdir(q.path):
+            out = ''
+        elif out.startswith('patches-'):
+            out = out[8:]
+
+        return _with_groups(g, out) if out else ''
 
     if opts.get("angle_brackets"):
         tag_start = r'\<([^><]*?\<)?'
@@ -346,6 +363,7 @@
             '|(\|pre_unapplied\([^%s]*?\))' % brackets[-1] +
             '|(\|post_unapplied\([^%s]*?\))' % brackets[-1] +
             ')*': _patches,
+        'queue': _queue,
         'rev(\|merge)?': _rev,
         'root': _root,
         'root\|basename': _basename,
@@ -522,6 +540,9 @@
          Display STRING immediately after each unapplied patch.  Useful for
          resetting color codes.
 
+queue
+     Display the name of the current MQ queue.
+
 rev
      Display the repository-local changeset number of the current parent.