# HG changeset patch
# User Pierre-Yves David <pierre-yves.da...@ens-lyon.org>
# Date 1482408413 -3600
#      Thu Dec 22 13:06:53 2016 +0100
# Node ID 7d0d86f63673633f2223f60a13d359a243cbb946
# Parent  75a71d27817d72d9516be85134306a8e4b1c5f96
# EXP-Topic color
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 75a71d27817d -r 7d0d86f63673 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 @@ def _terminfosetup(ui, mode):
     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:
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to