changeset 12693:33f0682ba8b1

color: add global option in extsetup() instead of globally This prevents side effects from occurring when importing the color extension.
author Brodie Rao <brodie@bitheap.org>
date Sun, 10 Oct 2010 12:21:36 -0500
parents 0ac7c5c8121a
children 04f6de46bf3a
files hgext/color.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/color.py	Sun Oct 10 11:05:06 2010 -0500
+++ b/hgext/color.py	Sun Oct 10 12:21:36 2010 -0500
@@ -223,10 +223,11 @@
         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