Mercurial > hg
comparison mercurial/changegroup.py @ 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 |
comparison
equal
deleted
inserted
replaced
39012:c921ad9cae08 | 39013:c4a2d19d393a |
---|---|
899 for (n, lr) in mfs.iteritems()] | 899 for (n, lr) in mfs.iteritems()] |
900 | 900 |
901 mfs.clear() | 901 mfs.clear() |
902 clrevs = set(cl.rev(x) for x in clnodes) | 902 clrevs = set(cl.rev(x) for x in clnodes) |
903 | 903 |
904 for chunk in self.generatefiles(changedfiles, commonrevs, | 904 it = self.generatefiles(changedfiles, commonrevs, |
905 source, mfdicts, fastpathlinkrev, | 905 source, mfdicts, fastpathlinkrev, |
906 fnodes, clrevs): | 906 fnodes, clrevs) |
907 yield chunk | 907 |
908 for path, chunks in it: | |
909 h = _fileheader(path) | |
910 size = len(h) | |
911 yield h | |
912 | |
913 for chunk in chunks: | |
914 size += len(chunk) | |
915 yield chunk | |
916 | |
917 close = closechunk() | |
918 size += len(close) | |
919 yield close | |
920 | |
921 self._verbosenote(_('%8.i %s\n') % (size, path)) | |
908 | 922 |
909 yield closechunk() | 923 yield closechunk() |
910 | 924 |
911 if clnodes: | 925 if clnodes: |
912 repo.hook('outgoing', node=hex(clnodes[0]), source=source) | 926 repo.hook('outgoing', node=hex(clnodes[0]), source=source) |
1155 else: | 1169 else: |
1156 revs = _sortnodesnormal(filerevlog, filenodes, | 1170 revs = _sortnodesnormal(filerevlog, filenodes, |
1157 self._reorder) | 1171 self._reorder) |
1158 | 1172 |
1159 progress.update(i + 1, item=fname) | 1173 progress.update(i + 1, item=fname) |
1160 h = _fileheader(fname) | |
1161 size = len(h) | |
1162 yield h | |
1163 | 1174 |
1164 it = deltagroup( | 1175 it = deltagroup( |
1165 self._repo, revs, filerevlog, False, lookupfilelog, | 1176 self._repo, revs, filerevlog, False, lookupfilelog, |
1166 self._deltaparentfn, self._builddeltaheader, | 1177 self._deltaparentfn, self._builddeltaheader, |
1167 ellipses=self._ellipses, | 1178 ellipses=self._ellipses, |
1168 clrevtolocalrev=clrevtolocalrev, | 1179 clrevtolocalrev=clrevtolocalrev, |
1169 fullclnodes=self._fullclnodes, | 1180 fullclnodes=self._fullclnodes, |
1170 precomputedellipsis=self._precomputedellipsis) | 1181 precomputedellipsis=self._precomputedellipsis) |
1171 | 1182 |
1172 for chunk in it: | 1183 yield fname, it |
1173 size += len(chunk) | 1184 |
1174 yield chunk | |
1175 | |
1176 close = closechunk() | |
1177 size += len(close) | |
1178 yield close | |
1179 | |
1180 self._verbosenote(_('%8.i %s\n') % (size, fname)) | |
1181 progress.complete() | 1185 progress.complete() |
1182 | 1186 |
1183 def _deltaparentprev(store, rev, p1, p2, prev): | 1187 def _deltaparentprev(store, rev, p1, p2, prev): |
1184 """Resolve a delta parent to the previous revision. | 1188 """Resolve a delta parent to the previous revision. |
1185 | 1189 |