[PATCH] color: add support for colorizing git subrepo diffs

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Jan 8 23:31:12 CST 2015



On 01/08/2015 01:35 PM, Sean Farley wrote:
>
> Mathias De Maré writes:
>
>> # HG changeset patch
>> # User Mathias De Maré <mathias.demare at gmail.com>
>> # Date 1420749022 -3600
>> #      Don Jan 08 21:30:22 2015 +0100
>> # Node ID a80a1e66eefc6431e37e382a5761d8296be7a481
>> # Parent  7ad155e13f0f51df8e986a0ec4e58ac9a0ccedbb
>> color: add support for colorizing git subrepo diffs
>>
>> diff --git a/hgext/color.py b/hgext/color.py
>> --- a/hgext/color.py
>> +++ b/hgext/color.py
>> @@ -144,7 +144,7 @@ codes).
>>
>>   import os
>>
>> -from mercurial import cmdutil, commands, dispatch, extensions, ui as uimod, util
>> +from mercurial import cmdutil, commands, dispatch, extensions, subrepo, ui as uimod, util
>>   from mercurial import templater, error
>>   from mercurial.i18n import _
>>
>> @@ -488,7 +488,15 @@ def uisetup(ui):
>>               extstyles()
>>               configstyles(ui_)
>>           return orig(ui_, opts, cmd, cmdfunc)
>> +    def colorgit(orig, gitsub, commands, env=None, stream=False, cwd=None):
>> +        if gitsub.ui._colormode:
>> +            if len(commands) and commands[0] == "diff":
>
> Small nit: this could be written as 'if gitsub.ui._colormode and command
> and commands[0] == "diff"' to save a level of indentation. Not really a
> show stopper though.

I've folded the conditional and the result is pushed to the clowncopter.

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list