[PATCH 1 of 1] mq/qqueue: print current queue name

Yann E. MORIN yann.morin.1998 at anciens.enib.fr
Fri Jul 29 13:36:37 CDT 2011


# HG changeset patch
# User "Yann E. MORIN" <yann.morin.1998 at anciens.enib.fr>
# Date 1311964012 -7200
# Branch stable
# Node ID 55a3d257a9af1b08a62d810c03e5423c007de787
# Parent  56848e2bb0c5a43b580dd2ca7ce1e781d4e75b2b
mq/qqueue: print current queue name

Add an option to qqueue to print only the name of the current queue.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998 at anciens.enib.fr>

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -2915,6 +2915,7 @@
 
 @command("qqueue",
          [('l', 'list', False, _('list all available queues')),
+          ('', 'active', False, _('print name of active queue')),
           ('c', 'create', False, _('create new queue')),
           ('', 'rename', False, _('rename active queue')),
           ('', 'delete', False, _('delete reference to queue')),
@@ -2929,7 +2930,8 @@
 
     Omitting a queue name or specifying -l/--list will show you the registered
     queues - by default the "normal" patches queue is registered. The currently
-    active queue will be marked with "(active)".
+    active queue will be marked with "(active)". Specifying --active will print
+    only the name of the active queue.
 
     To create a new queue, use -c/--create. The queue is automatically made
     active, except in the case where there are applied patches from the
@@ -3022,8 +3024,11 @@
         fh.close()
         util.rename(repo.join('patches.queues.new'), repo.join(_allqueues))
 
-    if not name or opts.get('list'):
+    if not name or opts.get('list') or opts.get('active'):
         current = _getcurrent()
+        if opts.get('active'):
+            ui.write('%s\n' % (current,))
+            return
         for queue in _getqueues():
             ui.write('%s' % (queue,))
             if queue == current and not ui.quiet:


More information about the Mercurial-devel mailing list