# HG changeset patch # User Martin Geisler # Date 1251498603 -7200 # Node ID 3a78bbc5766064b0338859b25e183ea9514f4ec3 # Parent 8e6019b16a7dbca67f5bf8c30f7022c98943f43d color: do all setup in uisetup Now that extensions are loaded in phases, we are guaranteed to always find mq in uisetup with extensions.find and we know that the mq commands are not yet copied into commands.table. diff -r 8e6019b16a7d -r 3a78bbc57660 hgext/color.py --- a/hgext/color.py Sun Aug 16 00:41:24 2009 +0200 +++ b/hgext/color.py Sat Aug 29 00:30:03 2009 +0200 @@ -218,12 +218,8 @@ 'changed': ['white'], 'trailingwhitespace': ['bold', 'red_background']} -_ui = None - def uisetup(ui): '''Initialize the extension.''' - global _ui - _ui = ui _setupcmd(ui, 'diff', commands.table, colordiff, _diff_effects) _setupcmd(ui, 'incoming', commands.table, None, _diff_effects) _setupcmd(ui, 'log', commands.table, None, _diff_effects) @@ -231,17 +227,10 @@ _setupcmd(ui, 'tip', commands.table, None, _diff_effects) _setupcmd(ui, 'status', commands.table, colorstatus, _status_effects) -def extsetup(): try: mq = extensions.find('mq') - try: - # If we are loaded after mq, we must wrap commands.table - _setupcmd(_ui, 'qdiff', commands.table, colordiff, _diff_effects) - _setupcmd(_ui, 'qseries', commands.table, colorqseries, _patch_effects) - except error.UnknownCommand: - # Otherwise we wrap mq.cmdtable - _setupcmd(_ui, 'qdiff', mq.cmdtable, colordiff, _diff_effects) - _setupcmd(_ui, 'qseries', mq.cmdtable, colorqseries, _patch_effects) + _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