changegroup: move size tracking and end of manifests to generate()
Preparing for all the generate* functions to emit data structures
instead of raw chunks.
Differential Revision: https://phab.mercurial-scm.org/D4208
--- a/mercurial/changegroup.py Wed Aug 08 14:15:33 2018 -0700
+++ b/mercurial/changegroup.py Wed Aug 08 15:09:12 2018 -0700
@@ -870,11 +870,16 @@
fnodes = {} # needed file nodes
+ size = 0
for chunk in self.generatemanifests(commonrevs, clrevorder,
fastpathlinkrev, mfs, fnodes, source,
clstate['clrevtomanifestrev']):
+ size += len(chunk)
yield chunk
+ self._verbosenote(_('%8.i (manifests)\n') % size)
+ yield self._manifestsend
+
mfdicts = None
if self._ellipses and self._isshallow:
mfdicts = [(self._repo.manifestlog[n].read(), lr)
@@ -1025,7 +1030,6 @@
return clnode
return lookupmflinknode
- size = 0
while tmfnodes:
dir, nodes = tmfnodes.popitem()
store = dirlog(dir)
@@ -1052,7 +1056,6 @@
if dir:
assert self.version == b'03'
chunk = _fileheader(dir)
- size += len(chunk)
yield chunk
it = deltagroup(
@@ -1065,16 +1068,11 @@
precomputedellipsis=self._precomputedellipsis)
for chunk in it:
- size += len(chunk)
yield chunk
close = closechunk()
- size += len(close)
yield close
- self._verbosenote(_('%8.i (manifests)\n') % size)
- yield self._manifestsend
-
# The 'source' parameter is useful for extensions
def generatefiles(self, changedfiles, commonrevs, source,
mfdicts, fastpathlinkrev, fnodes, clrevs):