[PATCH 2 of 4] mq/qqueue: --list does not print (active) with --quiet

Yann E. MORIN yann.morin.1998 at anciens.enib.fr
Sun Aug 8 16:21:37 CDT 2010

# HG changeset patch
# User "Yann E. MORIN" <yann.morin.1998 at anciens.enib.fr>
# Date 1281300541 -7200
# Node ID d68489232d4fe4bb237fdc9481353966d1e244bc
# Parent  c56f13f898d7dbdd771e65ceab606f6ccbc8bf3b
mq/qqueue: --list does not print (active) with --quiet

For scripting purposes, it can be convenient to get a
simple listing of available queues, without indication
of the active one.

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
@@ -2663,7 +2663,7 @@
         current = _getcurrent()
         for queue in _getqueues():
             ui.write('%s' % (queue,))
-            if queue == current:
+            if queue == current and not ui.quiet:
                 ui.write(_(' (active)\n'))
@@ -3021,7 +3021,8 @@
-             ('l', 'list', False, _('list all available queues')),
+             ('l', 'list', False, _('list all available queues, mark active one')),
+             ('q', 'quiet', False, _('with --list, only print the queues names')),
              ('c', 'create', False, _('create new queue')),
              ('', 'delete', False, _('delete reference to queue')),
diff --git a/tests/test-mq-qqueue b/tests/test-mq-qqueue
--- a/tests/test-mq-qqueue
+++ b/tests/test-mq-qqueue
@@ -28,6 +28,9 @@
 hg qqueue foo
 hg qqueue
+echo %% list queues, quiet
+hg qqueue --quiet
 echo %% fail creating queue with already existing name
 hg qqueue --create foo
 hg qqueue
diff --git a/tests/test-mq-qqueue.out b/tests/test-mq-qqueue.out
--- a/tests/test-mq-qqueue.out
+++ b/tests/test-mq-qqueue.out
@@ -12,6 +12,9 @@
 %% switch queue
 foo (active)
+%% list queues, quiet
 %% fail creating queue with already existing name
 abort: queue "foo" already exists
 foo (active)

More information about the Mercurial-devel mailing list