109 disable color. |
109 disable color. |
110 ''' |
110 ''' |
111 |
111 |
112 import os |
112 import os |
113 |
113 |
114 from mercurial import commands, dispatch, extensions, ui as uimod, util |
114 from mercurial import cmdutil, commands, dispatch, extensions, ui as uimod, util |
115 from mercurial import templater, error |
115 from mercurial import templater, error |
116 from mercurial.i18n import _ |
116 from mercurial.i18n import _ |
117 |
117 |
|
118 cmdtable = {} |
|
119 command = cmdutil.command(cmdtable) |
118 testedwith = 'internal' |
120 testedwith = 'internal' |
119 |
121 |
120 # start and stop parameters for effects |
122 # start and stop parameters for effects |
121 _effects = {'none': 0, 'black': 30, 'red': 31, 'green': 32, 'yellow': 33, |
123 _effects = {'none': 0, 'black': 30, 'red': 31, 'green': 32, 'yellow': 33, |
122 'blue': 34, 'magenta': 35, 'cyan': 36, 'white': 37, 'bold': 1, |
124 'blue': 34, 'magenta': 35, 'cyan': 36, 'white': 37, 'bold': 1, |
438 # i18n: 'always', 'auto', and 'never' are keywords and should |
440 # i18n: 'always', 'auto', and 'never' are keywords and should |
439 # not be translated |
441 # not be translated |
440 _("when to colorize (boolean, always, auto, or never)"), |
442 _("when to colorize (boolean, always, auto, or never)"), |
441 _('TYPE'))) |
443 _('TYPE'))) |
442 |
444 |
|
445 @command('debugcolor', [], 'hg debugcolor') |
443 def debugcolor(ui, repo, **opts): |
446 def debugcolor(ui, repo, **opts): |
444 global _styles |
447 global _styles |
445 _styles = {} |
448 _styles = {} |
446 for effect in _effects.keys(): |
449 for effect in _effects.keys(): |
447 _styles[effect] = effect |
450 _styles[effect] = effect |
577 orig(m.group(2), **opts) |
580 orig(m.group(2), **opts) |
578 m = re.match(ansire, m.group(3)) |
581 m = re.match(ansire, m.group(3)) |
579 finally: |
582 finally: |
580 # Explicitly reset original attributes |
583 # Explicitly reset original attributes |
581 _kernel32.SetConsoleTextAttribute(stdout, origattr) |
584 _kernel32.SetConsoleTextAttribute(stdout, origattr) |
582 |
|
583 cmdtable = { |
|
584 'debugcolor': |
|
585 (debugcolor, [], ('hg debugcolor')) |
|
586 } |
|