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