# HG changeset patch # User Dan Villiom Podlaski Christiansen # Date 1281708308 -7200 # Node ID 31f02288bbc47b10a897c24c7ec21966abbbbfec # Parent ff1044230bcac3c2c0a406bea194223284823595 mq: extend support for the --mq argument to extension commands This allows commands like `purge' to accept the --mq option. diff -r ff1044230bca -r 31f02288bbc4 hgext/mq.py --- a/hgext/mq.py Sun Aug 22 13:17:34 2010 +0200 +++ b/hgext/mq.py Fri Aug 13 16:05:08 2010 +0200 @@ -2928,13 +2928,21 @@ entry = extensions.wrapcommand(commands.table, 'init', mqinit) entry[1].extend(mqopt) - norepo = commands.norepo.split(" ") - for cmd in commands.table.keys(): - cmd = cmdutil.parsealiases(cmd)[0] - if cmd in norepo: - continue - entry = extensions.wrapcommand(commands.table, cmd, mqcommand) - entry[1].extend(mqopt) + nowrap = set(commands.norepo.split(" ") + ['qrecord']) + + def dotable(cmdtable): + for cmd in cmdtable.keys(): + cmd = cmdutil.parsealiases(cmd)[0] + if cmd in nowrap: + continue + entry = extensions.wrapcommand(cmdtable, cmd, mqcommand) + entry[1].extend(mqopt) + + dotable(commands.table) + + for extname, extmodule in extensions.extensions(): + if extmodule.__file__ != __file__: + dotable(getattr(extmodule, 'cmdtable', {})) seriesopts = [('s', 'summary', None, _('print first line of patch header'))] diff -r ff1044230bca -r 31f02288bbc4 tests/test-mq.t --- a/tests/test-mq.t Sun Aug 22 13:17:34 2010 +0200 +++ b/tests/test-mq.t Fri Aug 13 16:05:08 2010 +0200 @@ -170,6 +170,10 @@ A B +add an untracked file + + $ echo >> .hg/patches/flaf + status --mq with color (issue2096) $ hg status --mq --config extensions.color= --color=always @@ -177,9 +181,15 @@ A A A B A series + ? flaf + +try the --mq option on a command provided by an extension + + $ hg purge --mq --verbose --config extensions.purge= + Removing file flaf + $ cd .. - init --mq without repo $ mkdir f