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@anciens.enib.fr>
--- a/hgext/mq.py Sat Jul 30 11:08:45 2011 +0100
+++ b/hgext/mq.py Fri Jul 29 20:26:52 2011 +0200
@@ -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: