Mercurial > hg
changeset 39013:c4a2d19d393a
changegroup: move file chunk emission to generate()
Same deal as manifests. We want to get to a point where we can
emit data structures from deltagroup() and derive the raw
changegroup data as late as possible.
Differential Revision: https://phab.mercurial-scm.org/D4210
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 08 Aug 2018 14:33:33 -0700 |
parents | c921ad9cae08 |
children | d662959dc881 |
files | mercurial/changegroup.py |
diffstat | 1 files changed, 19 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/changegroup.py Wed Aug 08 15:14:59 2018 -0700 +++ b/mercurial/changegroup.py Wed Aug 08 14:33:33 2018 -0700 @@ -901,10 +901,24 @@ mfs.clear() clrevs = set(cl.rev(x) for x in clnodes) - for chunk in self.generatefiles(changedfiles, commonrevs, - source, mfdicts, fastpathlinkrev, - fnodes, clrevs): - yield chunk + it = self.generatefiles(changedfiles, commonrevs, + source, mfdicts, fastpathlinkrev, + fnodes, clrevs) + + for path, chunks in it: + h = _fileheader(path) + size = len(h) + yield h + + for chunk in chunks: + size += len(chunk) + yield chunk + + close = closechunk() + size += len(close) + yield close + + self._verbosenote(_('%8.i %s\n') % (size, path)) yield closechunk() @@ -1157,9 +1171,6 @@ self._reorder) progress.update(i + 1, item=fname) - h = _fileheader(fname) - size = len(h) - yield h it = deltagroup( self._repo, revs, filerevlog, False, lookupfilelog, @@ -1169,15 +1180,8 @@ fullclnodes=self._fullclnodes, precomputedellipsis=self._precomputedellipsis) - for chunk in it: - size += len(chunk) - yield chunk + yield fname, it - close = closechunk() - size += len(close) - yield close - - self._verbosenote(_('%8.i %s\n') % (size, fname)) progress.complete() def _deltaparentprev(store, rev, p1, p2, prev):