[PATCH] mq: add --mq option to some commands
Brendan Cully
brendan at kublai.com
Tue Dec 23 11:46:58 CST 2008
# HG changeset patch
# User Brendan Cully <brendan at kublai.com>
# Date 1230054400 28800
# Node ID c40bccf8d862d2b96e421976554dfa4edd511870
# Parent 73268e317ad3d422850b85925253cd186fe6303c
mq: add --mq option to some commands
This causes them to operate on the queue repository as qcommit does, and
is nicer than hg -R $(hg root)
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -2440,8 +2440,28 @@
kwargs.get('force'))
return orig(ui, repo, *args, **kwargs)
+def mqcommand(orig, ui, repo, *args, **kwargs):
+ """Add --mq option to operate on patch repository instead of main"""
+
+ # some commands do not like getting unknown options
+ mq = kwargs['mq']
+ del kwargs['mq']
+
+ if not mq:
+ return orig(ui, repo, *args, **kwargs)
+
+ q = repo.mq
+ r = q.qrepo()
+ if not r:
+ raise util.Abort('no queue repository')
+ return orig(ui, r, *args, **kwargs)
+
def uisetup(ui):
extensions.wrapcommand(commands.table, 'import', mqimport)
+ for cmd in ('commit', 'export', 'incoming', 'log', 'outgoing', 'pull',
+ 'push', 'status', 'tag', 'tags', 'tip', 'update'):
+ entry = extensions.wrapcommand(commands.table, cmd, mqcommand)
+ entry[1].extend([('', 'mq', None, _("operate on patch repository"))])
seriesopts = [('s', 'summary', None, _('print first line of patch header'))]
More information about the Mercurial-devel
mailing list