Commits

Steve Losh committed 645406a

Add the {queue} keyword.

Comments (0)

Files changed (2)

docs/wiki/documentation/keywords/index.mdown

     :   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.
     
                 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'\<([^><]*?\<)?'
             '|(\|pre_unapplied\([^%s]*?\))' % brackets[-1] +
             '|(\|post_unapplied\([^%s]*?\))' % brackets[-1] +
             ')*': _patches,
+        'queue': _queue,
         'rev(\|merge)?': _rev,
         'root': _root,
         'root\|basename': _basename,
          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.