diff hgext/color.py @ 9711:d29bd00bbc50

color: wrap qrecord The qrecord command is registered in uisetup phase, so we do our wrapping in extsetup phase.
author Martin Geisler <mg@lazybytes.net>
date Thu, 05 Nov 2009 01:11:28 +0100
parents 9b99f158348a
children af04a3dea4cd
line wrap: on
line diff
--- a/hgext/color.py	Thu Nov 05 01:10:43 2009 +0100
+++ b/hgext/color.py	Thu Nov 05 01:11:28 2009 +0100
@@ -235,7 +235,7 @@
                  'changed': ['white'],
                  'trailingwhitespace': ['bold', 'red_background']}
 
-def uisetup(ui):
+def extsetup(ui):
     '''Initialize the extension.'''
     _setupcmd(ui, 'diff', commands.table, colordiff, _diff_effects)
     _setupcmd(ui, 'incoming', commands.table, None, _diff_effects)
@@ -249,15 +249,17 @@
         _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
+        mq = None
 
     try:
         rec = extensions.find('record')
         _setupcmd(ui, 'record', rec.cmdtable, colordiff, _diff_effects)
     except KeyError:
-        # The record extension is not enabled
-        pass
+        rec = None
+
+    if mq and rec:
+        _setupcmd(ui, 'qrecord', rec.cmdtable, colordiff, _diff_effects)
+
 
 def _setupcmd(ui, cmd, table, func, effectsmap):
     '''patch in command to command table and load effect map'''