[PATCH 4 of 6] color: merge two identical 'for' loops
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Tue Feb 21 17:18:00 EST 2017
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1487238747 -3600
# Thu Feb 16 10:52:27 2017 +0100
# Node ID 1f69891d7e7abe1f3707c5f184498eadcd42dc6f
# Parent 7d0d86f63673633f2223f60a13d359a243cbb946
# EXP-Topic color
color: merge two identical 'for' loops
The previous changeset made it clear that we are iterating twice on the same
items. We gather the two loops into a single one.
diff -r 7d0d86f63673 -r 1f69891d7e7a hgext/color.py
--- a/hgext/color.py Thu Dec 22 13:06:53 2016 +0100
+++ b/hgext/color.py Thu Feb 16 10:52:27 2017 +0100
@@ -206,9 +206,7 @@ def _terminfosetup(ui, mode):
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.'):
+ elif key.startswith('terminfo.'):
newval = (True, '', val.replace('\\E', '\x1b'))
color._terminfo_params[key[9:]] = newval
try:
More information about the Mercurial-devel
mailing list