[PATCH] color: don't blow up if configured with unknown color

Greg Ward greg-hg at gerg.ca
Thu Jun 25 08:22:46 CDT 2009


On Wed, Jun 24, 2009 at 10:58 AM, Matt Mackall<mpm at selenic.com> wrote:
> 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

Ah!  Thank you, that works with a little massaging.  Revised patch
coming shortly.

Greg



More information about the Mercurial-devel mailing list