[PATCH 6 of 8] context: add private _dirstatestatus method

Sean Farley sean.michael.farley at gmail.com
Mon May 12 17:02:01 CDT 2014


Durham Goode <durham at fb.com> writes:

> On 5/6/14, 4:33 PM, Sean Farley wrote:
>> # HG changeset patch
>> # User Sean Farley <sean.michael.farley at gmail.com>
>> # Date 1398190491 18000
>> #      Tue Apr 22 13:14:51 2014 -0500
>> # Node ID d556bbc7a4a12f0c644be280a95c649f0d113437
>> # Parent  2bb99e94978f9da3a6eb50bbddcbbfec28f399a1
>> context: add private _dirstatestatus method
>>
>> This method is mostly a copy from workingctx.status. The custom status method
> You mean localrepo.status?  This code doesn't exist in workingctx.status 
> yet.

Oops, yep. I meant from localrepo.status.

>> of workingctx will eventually be absorbed by the refactoring of
>> localrepo.status to context.status but unfortunately we can't do it in one
>> step.
>>
>> diff --git a/mercurial/context.py b/mercurial/context.py
>> --- a/mercurial/context.py
>> +++ b/mercurial/context.py
>> @@ -1213,10 +1213,33 @@ class workingctx(committablectx):
>>                       wlock.release()
>>               except error.LockError:
>>                   pass
>>           return modified, fixup
>>   
>> +    def _dirstatestatus(self, match=None, ignored=False, clean=False,
>> +                        unknown=False):
>> +        '''Gets the status from the dirstate -- internal use only.'''
>> +        listignored, listclean, listunknown = ignored, clean, unknown
>> +        match = match or matchmod.always(self._repo.root, self._repo.getcwd())
>> +        subrepos = []
>> +        if '.hgsub' in self:
>> +            subrepos = sorted(self.substate)
>> +        s = self._repo.dirstate.status(match, subrepos, listignored,
>> +                                       listclean, listunknown)
>> +        cmp, modified, added, removed, deleted, unknown, ignored, clean = s
>> +
>> +        # check for any possibly clean files
>> +        if cmp:
> In localrepo.status, this line is 'if parentworking and cmp:' which 
> implies that the code above could be used in a situation where we're not 
> comparing against the parent, and that the code below should only be run 
> if we are comparing against parent.  So... how will that get handled now?

This patch series is trying to get rid of the need to have a
'parentworking' variable at all and call the workingctx.status method
directly. In other words, the 'parentworking' check will be done before
calling this method. This helps remove the parentworking logic from this
code.


More information about the Mercurial-devel mailing list