diff hgext/color.py @ 10045:d1f9640e9a67

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.
author David Soria Parra <dsp@php.net>
date Fri, 11 Dec 2009 11:04:31 +0100
parents af04a3dea4cd
children 0c23b0b3516b
line wrap: on
line diff
--- 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)