color: don't blow up if configured with unknown color (just warn).
--- a/hgext/color.py Wed Jun 24 19:20:59 2009 +0200
+++ b/hgext/color.py Thu Jun 25 09:23:33 2009 -0400
@@ -261,6 +261,15 @@
])
for status in effectsmap:
- effects = ui.configlist('color', cmd + '.' + status)
+ configkey = cmd + '.' + status
+ effects = ui.configlist('color', configkey)
if effects:
- effectsmap[status] = effects
+ good = []
+ for e in effects:
+ if e in _effect_params:
+ good.append(e)
+ else:
+ ui.warn(_("ignoring unknown color/effect %r "
+ "(configured in color.%s)\n")
+ % (e, configkey))
+ effectsmap[status] = good
--- a/tests/test-status-color Wed Jun 24 19:20:59 2009 +0200
+++ b/tests/test-status-color Thu Jun 25 09:23:33 2009 -0400
@@ -61,6 +61,9 @@
rm deleted
hg copy modified copied
+echo "% test unknown color"
+hg --config color.status.modified=periwinkle status --color=always
+
# Run status with 2 different flags.
# Check if result is the same or different.
# If result is not as expected, raise error
--- a/tests/test-status-color.out Wed Jun 24 19:20:59 2009 +0200
+++ b/tests/test-status-color.out Thu Jun 25 09:23:33 2009 -0400
@@ -124,3 +124,11 @@
adding deleted
adding modified
adding removed
+% test unknown color
+ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
+M modified
+[0;32;1mA added[0m
+[0;32;1mA copied[0m
+[0;31;1mR removed[0m
+[0;36;1;4m! deleted[0m
+[0;35;1;4m? unknown[0m