# HG changeset patch # User Pierre-Yves David # Date 1482408413 -3600 # Node ID cf2bc3792ef4812c723f9701f3fd2756f3ff03c7 # Parent 27d3bc0c9093bce1bd085b19db4fd9b0cc493863 color: minor simplification of some terminfo setup code No logic change is introduced. The previous code were using a 'dict.update' with a complex generator. That was a bit confusing to read and not so compact. Instead we now use an explicit loop and conditional for the sake of clarity. This also allow for more simplification coming in the next changeset. diff -r 27d3bc0c9093 -r cf2bc3792ef4 hgext/color.py --- a/hgext/color.py Thu Dec 22 06:17:40 2016 +0100 +++ b/hgext/color.py Thu Dec 22 13:06:53 2016 +0100 @@ -202,14 +202,15 @@ if mode not in ('auto', 'terminfo'): return - color._terminfo_params.update((key[6:], (False, int(val), '')) - for key, val in ui.configitems('color') - if key.startswith('color.')) - color._terminfo_params.update((key[9:], - (True, '', val.replace('\\E', '\x1b'))) - for key, val in ui.configitems('color') - if key.startswith('terminfo.')) + for key, val in ui.configitems('color'): + if key.startswith('color.'): + newval = (False, int(val), '') + color._terminfo_params[key[6:]] = newval + for key, val in ui.configitems('color'): + if key.startswith('terminfo.'): + newval = (True, '', val.replace('\\E', '\x1b')) + color._terminfo_params[key[9:]] = newval try: curses.setupterm() except curses.error as e: