[PATCH] color: don't blow up if configured with unknown color
Matt Mackall
mpm at selenic.com
Wed Jun 24 09:58:43 CDT 2009
On Wed, 2009-06-24 at 02:49 +0000, Greg Ward wrote:
>
> # HG changeset patch
> # User Greg Ward <greg-hg at gerg.ca>
> # Date 1245811720 14400
> # Node ID 9de8ccf861370259326036e267025d6661734b58
> # Parent 5e6a6fb10a77f1a55e0f9acd49ee5aea6004dc78
> color: don't blow up if configured with unknown color.
>
> (I wanted to print a warning in this case, but getting a ui object
> down
> to where the error happens looks rather tricky, so I punted.)
How about like this:
diff -r 77c1ce39fea7 hgext/color.py
--- a/hgext/color.py Tue Jun 23 22:20:54 2009 -0400
+++ b/hgext/color.py Wed Jun 24 09:58:19 2009 -0500
@@ -263,4 +263,11 @@
for status in effectsmap:
effects = ui.configlist('color', cmd + '.' + status)
if effects:
- effectsmap[status] = effects
+ good = []
+ for e in effects:
+ if e in _effect_params:
+ good.append(e)
+ else:
+ ui.warn(_("unknown color/effect %r (ignoring)") % e)
+ else:
+ effectsmap[status] = good
--
http://selenic.com : development and support for Mercurial and Linux
More information about the Mercurial-devel
mailing list