Mercurial > hg-stable
changeset 21991:aca137619a45 stable
color: pass on key error for win32 (issue4298)
This is a quick fix for some consoles on windows (consoles that are not mingw
based) so that the debugcolor command doesn't throw a KeyError when effects
aren't supported (e.g. italic).
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Fri, 01 Aug 2014 13:09:06 -0500 |
parents | 48e32c2c499b |
children | 6be1e1dbe6a0 45a81266434f |
files | hgext/color.py |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/color.py Fri Aug 01 18:30:18 2014 -0700 +++ b/hgext/color.py Fri Aug 01 13:09:06 2014 -0500 @@ -562,8 +562,12 @@ for l in label.split(): style = _styles.get(l, '') for effect in style.split(): - attr = mapcolor(w32effects[effect], attr) - + try: + attr = mapcolor(w32effects[effect], attr) + except KeyError: + # w32effects could not have certain attributes so we skip + # them if not found + pass # hack to ensure regexp finds data if not text.startswith('\033['): text = '\033[m' + text