color: Do not pass --color, --no-color parameters to wrapped function
authorDavid Soria Parra <dsp@php.net>
Fri, 11 Dec 2009 11:04:31 +0100
changeset 10045 d1f9640e9a67
parent 10044 dc5462d94a72
child 10046 0c23b0b3516b
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.
hgext/color.py
--- a/hgext/color.py	Sat Dec 12 16:54:33 2009 +0100
+++ b/hgext/color.py	Fri Dec 11 11:04:31 2009 +0100
@@ -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)