Mercurial > hg-stable
changeset 10359:ec02cf8d1628
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)
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Tue, 23 Dec 2008 09:46:40 -0800 |
parents | d42821cd5c96 |
children | bcf90e712dc3 |
files | hgext/mq.py |
diffstat | 1 files changed, 20 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Sat Feb 06 20:24:51 2010 +0100 +++ b/hgext/mq.py Tue Dec 23 09:46:40 2008 -0800 @@ -2607,8 +2607,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([('Q', 'mq', None, _("operate on patch repository"))]) seriesopts = [('s', 'summary', None, _('print first line of patch header'))]