Follow-up from review comments in D4081.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/changegroup.py (9 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Gregory Szorc | Aug 6 2018, 12:04 PM |
def _packmanifests(self, dir, mfnodes, lookuplinknode): | def _packmanifests(self, dir, mfnodes, lookuplinknode): | ||||
"""Pack flat manifests into a changegroup stream.""" | """Pack flat manifests into a changegroup stream.""" | ||||
assert not dir | assert not dir | ||||
for chunk in self.group(mfnodes, self._repo.manifestlog._revlog, | for chunk in self.group(mfnodes, self._repo.manifestlog._revlog, | ||||
lookuplinknode, units=_('manifests')): | lookuplinknode, units=_('manifests')): | ||||
yield chunk | yield chunk | ||||
def _packtreemanifests(self, dir, mfnodes, lookuplinknode): | def _packmanifestsdirheader(self, dir, mfnodes, lookuplinknode): | ||||
"""Version of _packmanifests that operates on directory manifests. | """Version of _packmanifests that encodes the directory name. | ||||
Encodes the directory name in the output so multiple manifests | Encodes the directory name in the output so multiple manifests | ||||
can be sent. | can be sent. | ||||
""" | """ | ||||
assert self.version == b'03' | |||||
if dir: | if dir: | ||||
assert self.version == b'03' | |||||
yield self._fileheader(dir) | yield self._fileheader(dir) | ||||
# TODO violates storage abstractions by assuming revlogs. | # TODO violates storage abstractions by assuming revlogs. | ||||
dirlog = self._repo.manifestlog._revlog.dirlog(dir) | dirlog = self._repo.manifestlog._revlog.dirlog(dir) | ||||
for chunk in self.group(mfnodes, dirlog, lookuplinknode, | for chunk in self.group(mfnodes, dirlog, lookuplinknode, | ||||
units=_('manifests')): | units=_('manifests')): | ||||
yield chunk | yield chunk | ||||
f = dir + p | f = dir + p | ||||
fclnodes = fnodes.setdefault(f, {}) | fclnodes = fnodes.setdefault(f, {}) | ||||
fclnode = fclnodes.setdefault(n, clnode) | fclnode = fclnodes.setdefault(n, clnode) | ||||
if clrevorder[clnode] < clrevorder[fclnode]: | if clrevorder[clnode] < clrevorder[fclnode]: | ||||
fclnodes[n] = clnode | fclnodes[n] = clnode | ||||
return clnode | return clnode | ||||
return lookupmflinknode | return lookupmflinknode | ||||
fn = (self._packtreemanifests if self._sendtreemanifests | fn = (self._packmanifestsdirheader if self._sendtreemanifests | ||||
else self._packmanifests) | else self._packmanifests) | ||||
size = 0 | size = 0 | ||||
while tmfnodes: | while tmfnodes: | ||||
dir, nodes = tmfnodes.popitem() | dir, nodes = tmfnodes.popitem() | ||||
prunednodes = self._prune(dirlog(dir), nodes, commonrevs) | prunednodes = self._prune(dirlog(dir), nodes, commonrevs) | ||||
if not dir or prunednodes: | if not dir or prunednodes: | ||||
for x in fn(dir, prunednodes, makelookupmflinknode(dir, nodes)): | for x in fn(dir, prunednodes, makelookupmflinknode(dir, nodes)): | ||||
size += len(x) | size += len(x) |