color: look for mq with extensions.find
authorMartin Geisler <mg@lazybytes.net>
Sat, 02 May 2009 21:09:37 +0200
changeset 8278 1f9787de17d9
parent 8277 b9403042968a
child 8279 602ed4982f36
color: look for mq with extensions.find
hgext/color.py
--- a/hgext/color.py	Sat May 02 19:13:29 2009 +0200
+++ b/hgext/color.py	Sat May 02 21:09:37 2009 +0200
@@ -232,11 +232,13 @@
     _setupcmd(ui, 'outgoing', commands.table, None, _diff_effects)
     _setupcmd(ui, 'tip', commands.table, None, _diff_effects)
     _setupcmd(ui, 'status', commands.table, colorstatus, _status_effects)
-    if ui.config('extensions', 'hgext.mq') is not None or \
-            ui.config('extensions', 'mq') is not None:
-        from hgext import mq
+    try:
+        mq = extensions.find('mq')
         _setupcmd(ui, 'qdiff', mq.cmdtable, colordiff, _diff_effects)
         _setupcmd(ui, 'qseries', mq.cmdtable, colorqseries, _patch_effects)
+    except KeyError:
+        # The mq extension is not enabled
+        pass
 
 def _setupcmd(ui, cmd, table, func, effectsmap):
     '''patch in command to command table and load effect map'''