[PATCH 1 of 3] Prevent command options from aliasing each other
Dan Villiom Podlaski Christiansen
danchr at gmail.com
Mon Jul 6 08:22:58 CDT 2009
# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
# Date 1246878985 -7200
# Node ID 96e8bf2fe345a6caa2f4627615b5f1fb3afd61bd
# Parent 95046688f80fbe481241ed3affeed205ce378b7e
Prevent command options from aliasing each other.
This may lead to changes to options for one command inadvertently
affecting other commands.
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -2511,7 +2511,7 @@ cmdtable = {
_('hg qclone [OPTION]... SOURCE [DEST]')),
"qcommit|qci":
(commit,
- commands.table["^commit|ci"][1],
+ [] + commands.table["^commit|ci"][1],
_('hg qcommit [OPTION]... [FILE]...')),
"^qdiff":
(diff,
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3299,7 +3299,7 @@ table = {
(debugsub,
[('r', 'rev', '', _('revision to check'))],
_('[-r REV] [REV]')),
- "debugwalk": (debugwalk, walkopts, _('[OPTION]... [FILE]...')),
+ "debugwalk": (debugwalk, [] + walkopts, _('[OPTION]... [FILE]...')),
"^diff":
(diff,
[('r', 'rev', [], _('revision')),
@@ -3377,7 +3377,7 @@ table = {
' [--bundle FILENAME] [SOURCE]')),
"^init":
(init,
- remoteopts,
+ [] + remoteopts,
_('[-e CMD] [--remotecmd CMD] [DEST]')),
"locate":
(locate,
diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -105,6 +105,10 @@ def wrapcommand(table, command, wrapper)
wrap.__doc__ = getattr(origfn, '__doc__')
wrap.__module__ = getattr(origfn, '__module__')
+ # prevent option modifications from cascading to other commands by
+ # copying the options list.
+ entry = entry[:1] + ([] + entry[1],) + entry[2:]
+
newentry = list(entry)
newentry[0] = wrap
table[key] = tuple(newentry)
More information about the Mercurial-devel
mailing list