Show More
@@ -27,6 +27,13 b' that case, effects given to the last lab' | |||||
27 | effects. This includes the special "none" effect, which nullifies |
|
27 | effects. This includes the special "none" effect, which nullifies | |
28 | other effects. |
|
28 | other effects. | |
29 |
|
29 | |||
|
30 | Labels are normally invisible. In order to see these labels and their | |||
|
31 | position in the text, use the global --color=debug option. In case of | |||
|
32 | multiple labels for the same text, the labels will be enclosed by | |||
|
33 | square brackets, e.g. | |||
|
34 | ||||
|
35 | [log.changeset changeset.secret](changeset: 22611:6f0a53c8f587) | |||
|
36 | ||||
30 | The following are the default effects for some default labels. Default |
|
37 | The following are the default effects for some default labels. Default | |
31 | effects may be overridden from your configuration file:: |
|
38 | effects may be overridden from your configuration file:: | |
32 |
|
39 | |||
@@ -177,6 +184,9 b' def _terminfosetup(ui, mode):' | |||||
177 | def _modesetup(ui, coloropt): |
|
184 | def _modesetup(ui, coloropt): | |
178 | global _terminfo_params |
|
185 | global _terminfo_params | |
179 |
|
186 | |||
|
187 | if coloropt == 'debug': | |||
|
188 | return 'debug' | |||
|
189 | ||||
180 | auto = (coloropt == 'auto') |
|
190 | auto = (coloropt == 'auto') | |
181 | always = not auto and util.parsebool(coloropt) |
|
191 | always = not auto and util.parsebool(coloropt) | |
182 | if not always and not auto: |
|
192 | if not always and not auto: | |
@@ -387,10 +397,24 b' class colorui(uimod.ui):' | |||||
387 | return super(colorui, self).write_err( |
|
397 | return super(colorui, self).write_err( | |
388 | *[self.label(str(a), label) for a in args], **opts) |
|
398 | *[self.label(str(a), label) for a in args], **opts) | |
389 |
|
399 | |||
|
400 | def showlabel(self, msg, label): | |||
|
401 | if ' ' in label: | |||
|
402 | label = '[' + label + ']' | |||
|
403 | if label: | |||
|
404 | if msg and msg[-1] == '\n': | |||
|
405 | return "%s(%s)\n" % (label, msg[:-1]) | |||
|
406 | else: | |||
|
407 | return "%s(%s)" % (label, msg) | |||
|
408 | else: | |||
|
409 | return msg | |||
|
410 | ||||
390 | def label(self, msg, label): |
|
411 | def label(self, msg, label): | |
391 | if self._colormode is None: |
|
412 | if self._colormode is None: | |
392 | return super(colorui, self).label(msg, label) |
|
413 | return super(colorui, self).label(msg, label) | |
393 |
|
414 | |||
|
415 | if self._colormode == 'debug': | |||
|
416 | return self.showlabel(msg, label) | |||
|
417 | ||||
394 | effects = [] |
|
418 | effects = [] | |
395 | for l in label.split(): |
|
419 | for l in label.split(): | |
396 | s = _styles.get(l, '') |
|
420 | s = _styles.get(l, '') | |
@@ -436,7 +460,7 b' def uisetup(ui):' | |||||
436 | def colorcmd(orig, ui_, opts, cmd, cmdfunc): |
|
460 | def colorcmd(orig, ui_, opts, cmd, cmdfunc): | |
437 | mode = _modesetup(ui_, opts['color']) |
|
461 | mode = _modesetup(ui_, opts['color']) | |
438 | colorui._colormode = mode |
|
462 | colorui._colormode = mode | |
439 | if mode: |
|
463 | if mode and mode != 'debug': | |
440 | extstyles() |
|
464 | extstyles() | |
441 | configstyles(ui_) |
|
465 | configstyles(ui_) | |
442 | return orig(ui_, opts, cmd, cmdfunc) |
|
466 | return orig(ui_, opts, cmd, cmdfunc) | |
@@ -446,9 +470,9 b' def uisetup(ui):' | |||||
446 | def extsetup(ui): |
|
470 | def extsetup(ui): | |
447 | commands.globalopts.append( |
|
471 | commands.globalopts.append( | |
448 | ('', 'color', 'auto', |
|
472 | ('', 'color', 'auto', | |
449 |
# i18n: 'always', 'auto', |
|
473 | # i18n: 'always', 'auto', 'never', and 'debug' are keywords | |
450 | # not be translated |
|
474 | # and should not be translated | |
451 |
_("when to colorize (boolean, always, auto, |
|
475 | _("when to colorize (boolean, always, auto, never, or debug)"), | |
452 | _('TYPE'))) |
|
476 | _('TYPE'))) | |
453 |
|
477 | |||
454 | @command('debugcolor', [], 'hg debugcolor') |
|
478 | @command('debugcolor', [], 'hg debugcolor') |
@@ -20,6 +20,14 b' hg status in repo root:' | |||||
20 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc) |
|
20 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc) | |
21 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc) |
|
21 | \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4min_root\x1b[0m (esc) | |
22 |
|
22 | |||
|
23 | $ hg status --color=debug | |||
|
24 | status.unknown(? )status.unknown(a/1/in_a_1) | |||
|
25 | status.unknown(? )status.unknown(a/in_a) | |||
|
26 | status.unknown(? )status.unknown(b/1/in_b_1) | |||
|
27 | status.unknown(? )status.unknown(b/2/in_b_2) | |||
|
28 | status.unknown(? )status.unknown(b/in_b) | |||
|
29 | status.unknown(? )status.unknown(in_root) | |||
|
30 | ||||
23 | hg status . in repo root: |
|
31 | hg status . in repo root: | |
24 |
|
32 | |||
25 | $ hg status --color=always . |
|
33 | $ hg status --color=always . | |
@@ -137,6 +145,13 b' Make sure ui.formatted=False works' | |||||
137 | adding deleted |
|
145 | adding deleted | |
138 | adding modified |
|
146 | adding modified | |
139 | adding removed |
|
147 | adding removed | |
|
148 | $ hg log --color=debug | |||
|
149 | [log.changeset changeset.draft](changeset: 0:389aef86a55e) | |||
|
150 | log.tag(tag: tip) | |||
|
151 | log.user(user: test) | |||
|
152 | log.date(date: Thu Jan 01 00:00:00 1970 +0000) | |||
|
153 | log.summary(summary: initial checkin) | |||
|
154 | ||||
140 | $ touch modified added unknown ignored |
|
155 | $ touch modified added unknown ignored | |
141 | $ hg add added |
|
156 | $ hg add added | |
142 | $ hg remove removed |
|
157 | $ hg remove removed |
General Comments 0
You need to be logged in to leave comments.
Login now