[PATCH 2 of 7] color: initialize color for local peer ui

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Feb 28 05:24:42 EST 2017



On 02/28/2017 07:57 AM, Martin von Zweigbergk wrote:
> On Mon, Feb 27, 2017 at 6:59 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 1488044041 -3600
>> #      Sat Feb 25 18:34:01 2017 +0100
>> # Node ID c3224694bdae9cdb7530f952e2c767e419b7f280
>> # Parent  92526381242cd381375a465d5a800446916d2d7b
>> # EXP-Topic color
>> color: initialize color for local peer ui
>>
>> The local peer
>
> "local peer" or "localrepository"? The patch seems to be in "class
> localrepository".

hum, good catch. Things seems clowner than I expected. It looks like we 
don't use the "lui" (local ui, goes through uisetup) to create the 
repository but the "baseui" (does not goes through uisetup).

Let me grab a shovel and go bad into that code.

>> is creating its own local ui and goes through full
>> initialization (reading config, setting up extensions, etc). We must setup the
>> color for this one too.
>>
>> This was overlooked when the rest of the initialization changed but did not
>> had impact yet because all setup is still global. We fix it before it is too
>> late.
>>
>> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
>> --- a/mercurial/localrepo.py
>> +++ b/mercurial/localrepo.py
>> @@ -28,6 +28,7 @@ from . import (
>>      bundle2,
>>      changegroup,
>>      changelog,
>> +    color,
>>      context,
>>      dirstate,
>>      dirstateguard,
>> @@ -285,6 +286,7 @@ class localrepository(object):
>>                      setupfunc(self.ui, self.supported)
>>          else:
>>              self.supported = self._basesupported
>> +        color.setup(self.ui)
>>
>>          # Add compression engines.
>>          for name in util.compengines:
>> diff --git a/tests/test-status-color.t b/tests/test-status-color.t
>> --- a/tests/test-status-color.t
>> +++ b/tests/test-status-color.t
>> @@ -296,6 +296,7 @@ test unknown color
>>    $ hg --config color.status.modified=periwinkle status
>>    ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
>>    ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
>> +  ignoring unknown color/effect 'periwinkle' (configured in color.status.modified)
>>    M modified
>>    \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
>>    \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel at mercurial-scm.org
>> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list