Show More
@@ -60,7 +60,7 b' diff.trailingwhitespace = bold red_backg' | |||||
60 |
|
60 | |||
61 | import os, sys |
|
61 | import os, sys | |
62 |
|
62 | |||
63 | from mercurial import cmdutil, commands, extensions |
|
63 | from mercurial import cmdutil, commands, extensions, error | |
64 | from mercurial.i18n import _ |
|
64 | from mercurial.i18n import _ | |
65 |
|
65 | |||
66 | # start and stop parameters for effects |
|
66 | # start and stop parameters for effects | |
@@ -220,18 +220,30 b' def colordiff(orig, ui, repo, *pats, **o' | |||||
220 | 'changed': ['white'], |
|
220 | 'changed': ['white'], | |
221 | 'trailingwhitespace': ['bold', 'red_background']} |
|
221 | 'trailingwhitespace': ['bold', 'red_background']} | |
222 |
|
222 | |||
|
223 | _ui = None | |||
|
224 | ||||
223 | def uisetup(ui): |
|
225 | def uisetup(ui): | |
224 | '''Initialize the extension.''' |
|
226 | '''Initialize the extension.''' | |
|
227 | global _ui | |||
|
228 | _ui = ui | |||
225 | _setupcmd(ui, 'diff', commands.table, colordiff, _diff_effects) |
|
229 | _setupcmd(ui, 'diff', commands.table, colordiff, _diff_effects) | |
226 | _setupcmd(ui, 'incoming', commands.table, None, _diff_effects) |
|
230 | _setupcmd(ui, 'incoming', commands.table, None, _diff_effects) | |
227 | _setupcmd(ui, 'log', commands.table, None, _diff_effects) |
|
231 | _setupcmd(ui, 'log', commands.table, None, _diff_effects) | |
228 | _setupcmd(ui, 'outgoing', commands.table, None, _diff_effects) |
|
232 | _setupcmd(ui, 'outgoing', commands.table, None, _diff_effects) | |
229 | _setupcmd(ui, 'tip', commands.table, None, _diff_effects) |
|
233 | _setupcmd(ui, 'tip', commands.table, None, _diff_effects) | |
230 | _setupcmd(ui, 'status', commands.table, colorstatus, _status_effects) |
|
234 | _setupcmd(ui, 'status', commands.table, colorstatus, _status_effects) | |
|
235 | ||||
|
236 | def extsetup(): | |||
231 | try: |
|
237 | try: | |
232 | mq = extensions.find('mq') |
|
238 | mq = extensions.find('mq') | |
233 | _setupcmd(ui, 'qdiff', mq.cmdtable, colordiff, _diff_effects) |
|
239 | try: | |
234 | _setupcmd(ui, 'qseries', mq.cmdtable, colorqseries, _patch_effects) |
|
240 | # If we are loaded after mq, we must wrap commands.table | |
|
241 | _setupcmd(_ui, 'qdiff', commands.table, colordiff, _diff_effects) | |||
|
242 | _setupcmd(_ui, 'qseries', commands.table, colorqseries, _patch_effects) | |||
|
243 | except error.UnknownCommand: | |||
|
244 | # Otherwise we wrap mq.cmdtable | |||
|
245 | _setupcmd(_ui, 'qdiff', mq.cmdtable, colordiff, _diff_effects) | |||
|
246 | _setupcmd(_ui, 'qseries', mq.cmdtable, colorqseries, _patch_effects) | |||
235 | except KeyError: |
|
247 | except KeyError: | |
236 | # The mq extension is not enabled |
|
248 | # The mq extension is not enabled | |
237 | pass |
|
249 | pass |
General Comments 0
You need to be logged in to leave comments.
Login now