Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG8b9b93bf70b1: changegroup: rename dir to tree to avoid shadowing a built-in
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/changegroup.py (28 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Gregory Szorc | Aug 9 2018, 10:30 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg |
fnodes = {} # needed file nodes | fnodes = {} # needed file nodes | ||||
size = 0 | size = 0 | ||||
it = self.generatemanifests( | it = self.generatemanifests( | ||||
commonrevs, clrevorder, fastpathlinkrev, mfs, fnodes, source, | commonrevs, clrevorder, fastpathlinkrev, mfs, fnodes, source, | ||||
clstate['clrevtomanifestrev']) | clstate['clrevtomanifestrev']) | ||||
for dir, deltas in it: | for tree, deltas in it: | ||||
if dir: | if tree: | ||||
assert self.version == b'03' | assert self.version == b'03' | ||||
chunk = _fileheader(dir) | chunk = _fileheader(tree) | ||||
size += len(chunk) | size += len(chunk) | ||||
yield chunk | yield chunk | ||||
for delta in deltas: | for delta in deltas: | ||||
chunks = _revisiondeltatochunks(delta, self._builddeltaheader) | chunks = _revisiondeltatochunks(delta, self._builddeltaheader) | ||||
for chunk in chunks: | for chunk in chunks: | ||||
size += len(chunk) | size += len(chunk) | ||||
yield chunk | yield chunk | ||||
repo = self._repo | repo = self._repo | ||||
mfl = repo.manifestlog | mfl = repo.manifestlog | ||||
dirlog = mfl._revlog.dirlog | dirlog = mfl._revlog.dirlog | ||||
tmfnodes = {'': mfs} | tmfnodes = {'': mfs} | ||||
# Callback for the manifest, used to collect linkrevs for filelog | # Callback for the manifest, used to collect linkrevs for filelog | ||||
# revisions. | # revisions. | ||||
# Returns the linkrev node (collected in lookupcl). | # Returns the linkrev node (collected in lookupcl). | ||||
def makelookupmflinknode(dir, nodes): | def makelookupmflinknode(tree, nodes): | ||||
if fastpathlinkrev: | if fastpathlinkrev: | ||||
assert not dir | assert not tree | ||||
return mfs.__getitem__ | return mfs.__getitem__ | ||||
def lookupmflinknode(x): | def lookupmflinknode(x): | ||||
"""Callback for looking up the linknode for manifests. | """Callback for looking up the linknode for manifests. | ||||
Returns the linkrev node for the specified manifest. | Returns the linkrev node for the specified manifest. | ||||
SIDE EFFECT: | SIDE EFFECT: | ||||
1) fclnodes gets populated with the list of relevant | 1) fclnodes gets populated with the list of relevant | ||||
file nodes if we're not using fastpathlinkrev | file nodes if we're not using fastpathlinkrev | ||||
2) When treemanifests are in use, collects treemanifest nodes | 2) When treemanifests are in use, collects treemanifest nodes | ||||
to send | to send | ||||
Note that this means manifests must be completely sent to | Note that this means manifests must be completely sent to | ||||
the client before you can trust the list of files and | the client before you can trust the list of files and | ||||
treemanifests to send. | treemanifests to send. | ||||
""" | """ | ||||
clnode = nodes[x] | clnode = nodes[x] | ||||
mdata = mfl.get(dir, x).readfast(shallow=True) | mdata = mfl.get(tree, x).readfast(shallow=True) | ||||
for p, n, fl in mdata.iterentries(): | for p, n, fl in mdata.iterentries(): | ||||
if fl == 't': # subdirectory manifest | if fl == 't': # subdirectory manifest | ||||
subdir = dir + p + '/' | subtree = tree + p + '/' | ||||
tmfclnodes = tmfnodes.setdefault(subdir, {}) | tmfclnodes = tmfnodes.setdefault(subtree, {}) | ||||
tmfclnode = tmfclnodes.setdefault(n, clnode) | tmfclnode = tmfclnodes.setdefault(n, clnode) | ||||
if clrevorder[clnode] < clrevorder[tmfclnode]: | if clrevorder[clnode] < clrevorder[tmfclnode]: | ||||
tmfclnodes[n] = clnode | tmfclnodes[n] = clnode | ||||
else: | else: | ||||
f = dir + p | f = tree + 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 | ||||
while tmfnodes: | while tmfnodes: | ||||
dir, nodes = tmfnodes.popitem() | tree, nodes = tmfnodes.popitem() | ||||
store = dirlog(dir) | store = dirlog(tree) | ||||
if not self._filematcher.visitdir(store._dir[:-1] or '.'): | if not self._filematcher.visitdir(store._dir[:-1] or '.'): | ||||
prunednodes = [] | prunednodes = [] | ||||
else: | else: | ||||
frev, flr = store.rev, store.linkrev | frev, flr = store.rev, store.linkrev | ||||
prunednodes = [n for n in nodes | prunednodes = [n for n in nodes | ||||
if flr(frev(n)) not in commonrevs] | if flr(frev(n)) not in commonrevs] | ||||
if dir and not prunednodes: | if tree and not prunednodes: | ||||
continue | continue | ||||
lookupfn = makelookupmflinknode(dir, nodes) | lookupfn = makelookupmflinknode(tree, nodes) | ||||
deltas = deltagroup( | deltas = deltagroup( | ||||
self._repo, store, prunednodes, False, lookupfn, | self._repo, store, prunednodes, False, lookupfn, | ||||
self._forcedeltaparentprev, self._reorder, | self._forcedeltaparentprev, self._reorder, | ||||
ellipses=self._ellipses, | ellipses=self._ellipses, | ||||
units=_('manifests'), | units=_('manifests'), | ||||
clrevtolocalrev=clrevtolocalrev, | clrevtolocalrev=clrevtolocalrev, | ||||
fullclnodes=self._fullclnodes, | fullclnodes=self._fullclnodes, | ||||
precomputedellipsis=self._precomputedellipsis) | precomputedellipsis=self._precomputedellipsis) | ||||
yield dir, deltas | yield tree, deltas | ||||
# The 'source' parameter is useful for extensions | # The 'source' parameter is useful for extensions | ||||
def generatefiles(self, changedfiles, commonrevs, source, | def generatefiles(self, changedfiles, commonrevs, source, | ||||
mfdicts, fastpathlinkrev, fnodes, clrevs): | mfdicts, fastpathlinkrev, fnodes, clrevs): | ||||
changedfiles = list(filter(self._filematcher, changedfiles)) | changedfiles = list(filter(self._filematcher, changedfiles)) | ||||
if not fastpathlinkrev: | if not fastpathlinkrev: | ||||
def normallinknodes(unused, fname): | def normallinknodes(unused, fname): |