[PATCH 1 of 3 resend v2] color: add global option in extsetup() instead of globally

Brodie Rao brodie at bitheap.org
Sun Oct 10 12:24:14 CDT 2010


# HG changeset patch
# User Brodie Rao <brodie at bitheap.org>
# Date 1286731296 18000
# Node ID a27be73fcd7857c45f60887653b517bd83dd5738
# Parent  58a3e2608ae47b6e688c158ef8c6e0e3f80f953f
color: add global option in extsetup() instead of globally

This prevents side effects from occurring when importing the color
extension.

diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -223,10 +223,11 @@ def uisetup(ui):
         return orig(ui_, opts, cmd, cmdfunc)
     extensions.wrapfunction(dispatch, '_runcommand', colorcmd)
 
-commands.globalopts.append(
-    ('', 'color', 'auto',
-     _("when to colorize (boolean, always, auto, or never)"),
-     _('TYPE')))
+def extsetup(ui):
+    commands.globalopts.append(
+        ('', 'color', 'auto',
+         _("when to colorize (boolean, always, auto, or never)"),
+         _('TYPE')))
 
 try:
     import re, pywintypes, win32console as win32c


More information about the Mercurial-devel mailing list