Mercurial > hg
comparison mercurial/changegroup.py @ 39010:fcdab6629dde
changegroup: emit delta group close chunk outside of deltagroup()
I want to make deltagroup() emit data structures rather than
serialized deltas. Upcoming commits will demonstrate why.
Differential Revision: https://phab.mercurial-scm.org/D4207
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 08 Aug 2018 14:15:33 -0700 |
parents | 9e8eb2b444e5 |
children | 2ebdd265fe8c |
comparison
equal
deleted
inserted
replaced
39009:9e8eb2b444e5 | 39010:fcdab6629dde |
---|---|
698 If units is not None, progress detail will be generated, units specifies | 698 If units is not None, progress detail will be generated, units specifies |
699 the type of revlog that is touched (changelog, manifest, etc.). | 699 the type of revlog that is touched (changelog, manifest, etc.). |
700 """ | 700 """ |
701 # if we don't have any revisions touched by these changesets, bail | 701 # if we don't have any revisions touched by these changesets, bail |
702 if len(revs) == 0: | 702 if len(revs) == 0: |
703 yield closechunk() | |
704 return | 703 return |
705 | 704 |
706 cl = repo.changelog | 705 cl = repo.changelog |
707 | 706 |
708 # add the parent of the first rev | 707 # add the parent of the first rev |
751 yield x | 750 yield x |
752 | 751 |
753 if progress: | 752 if progress: |
754 progress.complete() | 753 progress.complete() |
755 | 754 |
756 yield closechunk() | |
757 | |
758 class cgpacker(object): | 755 class cgpacker(object): |
759 def __init__(self, repo, filematcher, version, allowreorder, | 756 def __init__(self, repo, filematcher, version, allowreorder, |
760 deltaparentfn, builddeltaheader, manifestsend, | 757 deltaparentfn, builddeltaheader, manifestsend, |
761 bundlecaps=None, ellipses=False, | 758 bundlecaps=None, ellipses=False, |
762 shallow=False, ellipsisroots=None, fullnodes=None): | 759 shallow=False, ellipsisroots=None, fullnodes=None): |
836 | 833 |
837 clstate, chunks = self._generatechangelog(cl, clnodes) | 834 clstate, chunks = self._generatechangelog(cl, clnodes) |
838 for chunk in chunks: | 835 for chunk in chunks: |
839 size += len(chunk) | 836 size += len(chunk) |
840 yield chunk | 837 yield chunk |
838 | |
839 close = closechunk() | |
840 size += len(close) | |
841 yield closechunk() | |
841 | 842 |
842 self._verbosenote(_('%8.i (changelog)\n') % size) | 843 self._verbosenote(_('%8.i (changelog)\n') % size) |
843 | 844 |
844 clrevorder = clstate['clrevorder'] | 845 clrevorder = clstate['clrevorder'] |
845 mfs = clstate['mfs'] | 846 mfs = clstate['mfs'] |
1065 | 1066 |
1066 for chunk in it: | 1067 for chunk in it: |
1067 size += len(chunk) | 1068 size += len(chunk) |
1068 yield chunk | 1069 yield chunk |
1069 | 1070 |
1071 close = closechunk() | |
1072 size += len(close) | |
1073 yield close | |
1074 | |
1070 self._verbosenote(_('%8.i (manifests)\n') % size) | 1075 self._verbosenote(_('%8.i (manifests)\n') % size) |
1071 yield self._manifestsend | 1076 yield self._manifestsend |
1072 | 1077 |
1073 # The 'source' parameter is useful for extensions | 1078 # The 'source' parameter is useful for extensions |
1074 def generatefiles(self, changedfiles, commonrevs, source, | 1079 def generatefiles(self, changedfiles, commonrevs, source, |
1163 precomputedellipsis=self._precomputedellipsis) | 1168 precomputedellipsis=self._precomputedellipsis) |
1164 | 1169 |
1165 for chunk in it: | 1170 for chunk in it: |
1166 size += len(chunk) | 1171 size += len(chunk) |
1167 yield chunk | 1172 yield chunk |
1173 | |
1174 close = closechunk() | |
1175 size += len(close) | |
1176 yield close | |
1177 | |
1168 self._verbosenote(_('%8.i %s\n') % (size, fname)) | 1178 self._verbosenote(_('%8.i %s\n') % (size, fname)) |
1169 progress.complete() | 1179 progress.complete() |
1170 | 1180 |
1171 def _deltaparentprev(store, rev, p1, p2, prev): | 1181 def _deltaparentprev(store, rev, p1, p2, prev): |
1172 """Resolve a delta parent to the previous revision. | 1182 """Resolve a delta parent to the previous revision. |