[PATCH 8 of 8] largefiles: inline redundant toname function in status

Martin von Zweigbergk martinvonz at gmail.com
Wed Oct 15 10:06:47 CDT 2014


On Wed, Oct 15, 2014 at 3:55 AM, Mads Kiilerich <mads at kiilerich.com> wrote:
> On 10/15/2014 06:50 AM, Martin von Zweigbergk wrote:
>>
>> On Tue, Oct 14, 2014 at 8:09 PM, Mads Kiilerich <mads at kiilerich.com>
>> wrote:
>>>
>>> # HG changeset patch
>>> # User Mads Kiilerich <madski at unity3d.com>
>>> # Date 1413342536 -7200
>>> #      Wed Oct 15 05:08:56 2014 +0200
>>> # Node ID defd3115ade0f094bcbd2f380cfffa3df5705b04
>>> # Parent  05f6422005091798fbe0f2a8d4d5d66ca2c78f28
>>> largefiles: inline redundant toname function in status
>>>
>>> Simpler and an optimization.
>>>
>>> diff --git a/hgext/largefiles/reposetup.py
>>> b/hgext/largefiles/reposetup.py
>>> --- a/hgext/largefiles/reposetup.py
>>> +++ b/hgext/largefiles/reposetup.py
>>> @@ -217,12 +217,8 @@ def reposetup(ui, repo):
>>>                                   clean)
>>>                       result = [sorted(list1 + list2)
>>>                                 for (list1, list2) in zip(normals,
>>> lfstatus)]
>>> -                else:
>>> -                    def toname(f):
>>> -                        if lfutil.isstandin(f):
>>> -                            return lfutil.splitstandin(f)
>>> -                        return f
>>> -                    result = [[toname(f) for f in items]
>>> +                else: # not against working directory
>>> +                    result = [[lfutil.splitstandin(f) or f for f in
>>> items]
>>
>> It's not obvious to me why this is equivalent. Are all the files in
>> 'items' standins (so lfutil.isstandin() returns True)?
>
>
> splitstandin will return None if there is no standin to split - and then the
> boolean short-circuit evaluation kicks in and turns it into f.

Oh, that explains it. I had missed the "or f" despite looking at it
multiple times. Looks good then.


More information about the Mercurial-devel mailing list