# HG changeset patch # User Sean Farley # Date 2014-08-01 18:09:06 # Node ID aca137619a455dcd3d7ed86b2a05fa28d53be0cd # Parent 48e32c2c499b6b06c2e1852f3c8d0a4b43a85265 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). diff --git a/hgext/color.py b/hgext/color.py --- a/hgext/color.py +++ b/hgext/color.py @@ -562,8 +562,12 @@ else: 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