##// END OF EJS Templates
color: enable debug option to show labels...
Jordi Gutiérrez Hermoso -
r22463:1c4ae0f6 default
parent child Browse files
Show More
@@ -27,6 +27,13 b' that case, effects given to the last lab'
27 27 effects. This includes the special "none" effect, which nullifies
28 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 37 The following are the default effects for some default labels. Default
31 38 effects may be overridden from your configuration file::
32 39
@@ -177,6 +184,9 b' def _terminfosetup(ui, mode):'
177 184 def _modesetup(ui, coloropt):
178 185 global _terminfo_params
179 186
187 if coloropt == 'debug':
188 return 'debug'
189
180 190 auto = (coloropt == 'auto')
181 191 always = not auto and util.parsebool(coloropt)
182 192 if not always and not auto:
@@ -387,10 +397,24 b' class colorui(uimod.ui):'
387 397 return super(colorui, self).write_err(
388 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 411 def label(self, msg, label):
391 412 if self._colormode is None:
392 413 return super(colorui, self).label(msg, label)
393 414
415 if self._colormode == 'debug':
416 return self.showlabel(msg, label)
417
394 418 effects = []
395 419 for l in label.split():
396 420 s = _styles.get(l, '')
@@ -436,7 +460,7 b' def uisetup(ui):'
436 460 def colorcmd(orig, ui_, opts, cmd, cmdfunc):
437 461 mode = _modesetup(ui_, opts['color'])
438 462 colorui._colormode = mode
439 if mode:
463 if mode and mode != 'debug':
440 464 extstyles()
441 465 configstyles(ui_)
442 466 return orig(ui_, opts, cmd, cmdfunc)
@@ -446,9 +470,9 b' def uisetup(ui):'
446 470 def extsetup(ui):
447 471 commands.globalopts.append(
448 472 ('', 'color', 'auto',
449 # i18n: 'always', 'auto', and 'never' are keywords and should
450 # not be translated
451 _("when to colorize (boolean, always, auto, or never)"),
473 # i18n: 'always', 'auto', 'never', and 'debug' are keywords
474 # and should not be translated
475 _("when to colorize (boolean, always, auto, never, or debug)"),
452 476 _('TYPE')))
453 477
454 478 @command('debugcolor', [], 'hg debugcolor')
@@ -20,6 +20,14 b' hg status in repo root:'
20 20 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mb/in_b\x1b[0m (esc)
21 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 31 hg status . in repo root:
24 32
25 33 $ hg status --color=always .
@@ -137,6 +145,13 b' Make sure ui.formatted=False works'
137 145 adding deleted
138 146 adding modified
139 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 155 $ touch modified added unknown ignored
141 156 $ hg add added
142 157 $ hg remove removed
General Comments 0
You need to be logged in to leave comments. Login now