# HG changeset patch # User Pierre-Yves David # Date 2016-12-22 12:19:12 # Node ID 350d737e059d9af1a2879da80e44086355123c94 # Parent ebd14a4b03fc774e1298f698e1a61c1cbdc3db7a color: minor reversal of two conditional clause for clarity Another minor cleanup while reading the code. The two branches of the conditional have similar complexity so we go for the order that give us the simplest condition (we drop the negation). diff --git a/mercurial/color.py b/mercurial/color.py --- a/mercurial/color.py +++ b/mercurial/color.py @@ -165,14 +165,14 @@ def _render_effects(text, effects): 'Wrap text in commands to turn on each effect.' if not text: return text - if not _terminfo_params: + if _terminfo_params: + start = ''.join(_effect_str(effect) + for effect in ['none'] + effects.split()) + stop = _effect_str('none') + else: start = [str(_effects[e]) for e in ['none'] + effects.split()] start = '\033[' + ';'.join(start) + 'm' stop = '\033[' + str(_effects['none']) + 'm' - else: - start = ''.join(_effect_str(effect) - for effect in ['none'] + effects.split()) - stop = _effect_str('none') return ''.join([start, text, stop]) w32effects = None