[PATCH 5 of 6 V5] manifest: get rid of manifest.readshallowfast

Durham Goode durham at fb.com
Fri Nov 4 19:06:48 EDT 2016



On 11/4/16 3:43 PM, Martin von Zweigbergk wrote:
> On Wed, Nov 2, 2016 at 6:30 PM, Durham Goode <durham at fb.com> wrote:
>> # HG changeset patch
>> # User Durham Goode <durham at fb.com>
>> # Date 1478131847 25200
>> #      Wed Nov 02 17:10:47 2016 -0700
>> # Branch stable
>> # Node ID 42cbc5a35d816cf9e5c0ab31791ab90df8004dab
>> # Parent  488f0af8cb92461a67b47bfe259e3378bb00769c
>> manifest: get rid of manifest.readshallowfast
>>
>> This removes manifest.readshallowfast and converts it's one user to use
>> manifestlog instead.
>>
>> diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
>> --- a/mercurial/changegroup.py
>> +++ b/mercurial/changegroup.py
>> @@ -676,7 +676,8 @@ class cg1packer(object):
>>       def generatemanifests(self, commonrevs, clrevorder, fastpathlinkrev, mfs,
>>                             fnodes):
>>           repo = self._repo
>> -        dirlog = repo.manifest.dirlog
>> +        mfl = repo.manifestlog
>> +        dirlog = mfl._revlog.dirlog
>>           tmfnodes = {'': mfs}
>>
>>           # Callback for the manifest, used to collect linkrevs for filelog
>> @@ -704,7 +705,7 @@ class cg1packer(object):
>>                   treemanifests to send.
>>                   """
>>                   clnode = tmfnodes[dir][x]
>> -                mdata = dirlog(dir).readshallowfast(x)
>> +                mdata = mfl.get(dir, x).readfast(shallow=True)
>>                   for p, n, fl in mdata.iterentries():
>>                       if fl == 't': # subdirectory manifest
>>                           subdir = dir + p + '/'
>> diff --git a/mercurial/manifest.py b/mercurial/manifest.py
>> --- a/mercurial/manifest.py
>> +++ b/mercurial/manifest.py
>> @@ -1351,6 +1351,12 @@ class manifestctx(object):
>>           return self._data
>>
>>       def readfast(self, shallow=False):
>> +        '''Calls either readdelta or read, based on which would be less work.
>> +        readdelta is called if the delta is against the p1, and therefore can be
>> +        read quickly.
>> +
>> +        If `shallow` is True, nothing changes since this is a flat manifest.
>> +        '''
>>           rl = self._repo.manifestlog._revlog
>>           r = rl.rev(self._node)
>>           deltaparent = rl.deltaparent(r)
>> @@ -1421,7 +1427,7 @@ class treemanifestctx(object):
>>           return self._node
>>
>>       def readdelta(self, shallow=False):
>> -        revlog = self._revlog
>> +        revlog = self._revlog()
> Looks like this should have been in the previous patch.
Woops, yes.  I'm not sure how the tests pass with this :/


More information about the Mercurial-devel mailing list