[PATCH] color: Do not pass --color, --no-color parameters to wrapped function
David Soria Parra
david.parra at student.kit.edu
Fri Dec 11 04:09:38 CST 2009
hgext/color.py | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
# HG changeset patch
# User David Soria Parra <dsp at php.net>
# Date 1260525871 -3600
# Node ID 2118c2fe1a3d1cf93e0355fa675d9e994d7ae174
# Parent 0b0a46607ac9ea8031d516a3806ba5a523cf39cf
color: Do not pass --color, --no-color parameters to wrapped function
Passing the --color and --no-color parameter to the wrapped function
can cause a invalid argument exception if the wrapped function doesn't
accepts a **opts dict.
diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -282,10 +282,14 @@
if (opts['no_color'] or opts['color'] == 'never' or
(opts['color'] == 'auto' and (os.environ.get('TERM') == 'dumb'
or not sys.__stdout__.isatty()))):
+ del opts['no_color']
+ del opts['color']
return orig(*args, **opts)
oldshowpatch = extensions.wrapfunction(cmdutil.changeset_printer,
'showpatch', colorshowpatch)
+ del opts['no_color']
+ del opts['color']
try:
if func is not None:
return func(orig, *args, **opts)
More information about the Mercurial-devel
mailing list