[PATCH 2 of 2 V4] color: fallback and test label as an effect
Sean Farley
sean.michael.farley at gmail.com
Mon Apr 7 23:20:01 UTC 2014
# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1396903047 18000
# Mon Apr 07 15:37:27 2014 -0500
# Node ID c3f05ce58c1a48c70a6d998a6fe64533a28fb262
# Parent fe252f8b05c6a0e3b3ad4ed54d90c5bac07c0d6b
color: fallback and test label as an effect
With this changeset, we can now send a color name directly to the label
function, e.g.
$ hg log -r . -T "{label('red', node|short)}\n"
diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -380,10 +380,12 @@ class colorui(uimod.ui):
effects = []
for l in label.split():
s = _styles.get(l, '')
if s:
effects.append(s)
+ elif valideffect(l):
+ effects.append(l)
effects = ' '.join(effects)
if effects:
return '\n'.join([render_effects(s, effects)
for s in msg.split('\n')])
return msg
More information about the Mercurial-devel
mailing list