[PATCH 4 of 7] color: move the dict with terminfo parameters on the ui object

Sean Farley sean at farley.io
Thu Mar 9 04:35:44 UTC 2017


Martin von Zweigbergk via Mercurial-devel
<mercurial-devel at mercurial-scm.org> writes:

> On Mon, Feb 27, 2017 at 7:00 AM, Pierre-Yves David
> <pierre-yves.david at ens-lyon.org> wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
>> # Date 1488031251 -3600
>> #      Sat Feb 25 15:00:51 2017 +0100
>> # Node ID bdebc6e9429942e8dec6b9b6fe38be8c11bb06d9
>> # Parent  c6d19f0ac5ae80f933602fe217ff12ace828d02f
>> # EXP-Topic color
>> color: move the dict with terminfo parameters on the ui object
>>
>> This dictionnary is affected by the content of the config, so we should have
>> one for each ui config.
>>
>> We rename the global dict to '_baseterminfoparams' to make the situation
>> clearer.
>>
>> diff --git a/hgext/color.py b/hgext/color.py
>> --- a/hgext/color.py
>> +++ b/hgext/color.py
>> @@ -212,7 +212,7 @@ def _debugdisplaycolor(ui):
>>          color._styles.clear()
>>          for effect in color._effects.keys():
>>              color._styles[effect] = effect
>> -        if color._terminfo_params:
>> +        if ui._terminfoparams:
>>              for k, v in ui.configitems('color'):
>>                  if k.startswith('color.'):
>>                      color._styles[k] = k[6:]
>> diff --git a/mercurial/color.py b/mercurial/color.py
>> --- a/mercurial/color.py
>> +++ b/mercurial/color.py
>> @@ -19,7 +19,7 @@ try:
>>      import curses
>>      # Mapping from effect name to terminfo attribute name (or raw code) or
>>      # color number.  This will also force-load the curses module.
>> -    _terminfo_params = {'none': (True, 'sgr0', ''),
>> +    _baseterminfoparams = {'none': (True, 'sgr0', ''),
>
> You forgot to re-indent the following lines :-) (This is why I prefer
> putting the braces on separate lines as I mentioned in an earlier
> email.)

Yeah, I _strongly_ prefer braces on separate lines as Martin does.


More information about the Mercurial-devel mailing list