[PATCH 18 of 19] workingctx: customize _matchstatus for parentworking case

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu May 15 23:22:28 CDT 2014



On 05/15/2014 06:13 PM, Sean Farley wrote:
>
> Pierre-Yves David <pierre-yves.david at ens-lyon.org> writes:
>
>> On 05/15/2014 02:16 PM, Sean Farley wrote:
>>> # HG changeset patch
>>> # User Sean Farley <sean.michael.farley at gmail.com>
>>> # Date 1398346348 18000
>>> #      Thu Apr 24 08:32:28 2014 -0500
>>> # Node ID a7bf5d5ab5a5671c5362389d52a2e3dd438be49c
>>> # Parent  0770226fad0f8961a755cb516c9e0604c7a4209a
>>> workingctx: customize _matchstatus for parentworking case
>>
>> There is some strange magic going on here. Please elaborate.
>
> Yeah, sorry about that. This is only to get rid of having all kinds of
> special case if-blocks, specifically:
>
>
> if not parentworking:
>      def bad(f, msg):
>          # 'f' may be a directory pattern from 'match.files()',
>          # so 'f not in ctx1' is not enough
>          if f not in ctx1 and f not in ctx1.dirs():
>              self.ui.warn('%s: %s\n' % (self.dirstate.pathto(f), msg))
>      match.bad = bad

please explicite that the special bad function is meant to handle 
special case with directory pattern (or something more accurate if needed)

>>> diff --git a/mercurial/context.py b/mercurial/context.py
>>> --- a/mercurial/context.py
>>> +++ b/mercurial/context.py
>>> @@ -1318,10 +1318,26 @@ class workingctx(committablectx):
>>>                s = super(workingctx, self)._generatestatus(other, s, match,
>>>                                                            listignored, listclean,
>>>                                                            listunknown)
>>>            return s
>>>
>>> +    def _matchstatus(self, other, s, match, listignored, listclean,
>>> +                     listunknown):
>>> +        """return different match.bad if other isn't parent"""
>>
>> As said before, the black magic in strong in this area. You want a full
>> featured docstring.
>>
>> Reminder: doc-string works as changeset description
>>
>>     short oneliner
>>
>>     longer details
>>     one multiple line
>
> I think I got that line from Sid!

I do not really care about who wrote it. I mostly care about it being fixed.


-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list