Show More
@@ -522,6 +522,15 b' class revisiondelta(object):' | |||
|
522 | 522 | # Iterable of chunks holding raw delta data. |
|
523 | 523 | deltachunks = attr.ib() |
|
524 | 524 | |
|
525 | def _revisiondeltatochunks(delta, headerfn): | |
|
526 | """Serialize a revisiondelta to changegroup chunks.""" | |
|
527 | meta = headerfn(delta) | |
|
528 | l = len(meta) + sum(len(x) for x in delta.deltachunks) | |
|
529 | yield chunkheader(l) | |
|
530 | yield meta | |
|
531 | for x in delta.deltachunks: | |
|
532 | yield x | |
|
533 | ||
|
525 | 534 | def _sortnodesnormal(store, nodes, reorder): |
|
526 | 535 | """Sort nodes for changegroup generation and turn into revnums.""" |
|
527 | 536 | # for generaldelta revlogs, we linearize the revs; this will both be |
@@ -682,18 +691,12 b' def _revisiondeltanarrow(cl, store, isch' | |||
|
682 | 691 | ) |
|
683 | 692 | |
|
684 | 693 | def deltagroup(repo, revs, store, ischangelog, lookup, deltaparentfn, |
|
685 |
|
|
|
694 | units=None, | |
|
686 | 695 | ellipses=False, clrevtolocalrev=None, fullclnodes=None, |
|
687 | 696 | precomputedellipsis=None): |
|
688 | """Calculate a delta group, yielding a sequence of changegroup chunks | |
|
689 | (strings). | |
|
697 | """Calculate deltas for a set of revisions. | |
|
690 | 698 | |
|
691 | Given a list of changeset revs, return a set of deltas and | |
|
692 | metadata corresponding to nodes. The first delta is | |
|
693 | first parent(nodelist[0]) -> nodelist[0], the receiver is | |
|
694 | guaranteed to have this parent as it has all history before | |
|
695 | these changesets. In the case firstparent is nullrev the | |
|
696 | changegroup starts with a full revision. | |
|
699 | Is a generator of ``revisiondelta`` instances. | |
|
697 | 700 | |
|
698 | 701 | If units is not None, progress detail will be generated, units specifies |
|
699 | 702 | the type of revlog that is touched (changelog, manifest, etc.). |
@@ -739,15 +742,8 b' def deltagroup(repo, revs, store, ischan' | |||
|
739 | 742 | delta = _revisiondeltanormal(store, curr, prev, linknode, |
|
740 | 743 | deltaparentfn) |
|
741 | 744 | |
|
742 |
if |
|
|
743 |
|
|
|
744 | ||
|
745 | meta = deltaheaderfn(delta) | |
|
746 | l = len(meta) + sum(len(x) for x in delta.deltachunks) | |
|
747 | yield chunkheader(l) | |
|
748 | yield meta | |
|
749 | for x in delta.deltachunks: | |
|
750 | yield x | |
|
745 | if delta: | |
|
746 | yield delta | |
|
751 | 747 | |
|
752 | 748 | if progress: |
|
753 | 749 | progress.complete() |
@@ -831,10 +827,11 b' class cgpacker(object):' | |||
|
831 | 827 | self._verbosenote(_('uncompressed size of bundle content:\n')) |
|
832 | 828 | size = 0 |
|
833 | 829 | |
|
834 |
clstate, |
|
|
835 |
for |
|
|
836 | size += len(chunk) | |
|
837 |
|
|
|
830 | clstate, deltas = self._generatechangelog(cl, clnodes) | |
|
831 | for delta in deltas: | |
|
832 | for chunk in _revisiondeltatochunks(delta, self._builddeltaheader): | |
|
833 | size += len(chunk) | |
|
834 | yield chunk | |
|
838 | 835 | |
|
839 | 836 | close = closechunk() |
|
840 | 837 | size += len(close) |
@@ -875,16 +872,18 b' class cgpacker(object):' | |||
|
875 | 872 | commonrevs, clrevorder, fastpathlinkrev, mfs, fnodes, source, |
|
876 | 873 | clstate['clrevtomanifestrev']) |
|
877 | 874 | |
|
878 |
for dir, |
|
|
875 | for dir, deltas in it: | |
|
879 | 876 | if dir: |
|
880 | 877 | assert self.version == b'03' |
|
881 | 878 | chunk = _fileheader(dir) |
|
882 | 879 | size += len(chunk) |
|
883 | 880 | yield chunk |
|
884 | 881 | |
|
885 |
for |
|
|
886 | size += len(chunk) | |
|
887 |
|
|
|
882 | for delta in deltas: | |
|
883 | chunks = _revisiondeltatochunks(delta, self._builddeltaheader) | |
|
884 | for chunk in chunks: | |
|
885 | size += len(chunk) | |
|
886 | yield chunk | |
|
888 | 887 | |
|
889 | 888 | close = closechunk() |
|
890 | 889 | size += len(close) |
@@ -905,14 +904,16 b' class cgpacker(object):' | |||
|
905 | 904 | source, mfdicts, fastpathlinkrev, |
|
906 | 905 | fnodes, clrevs) |
|
907 | 906 | |
|
908 |
for path, |
|
|
907 | for path, deltas in it: | |
|
909 | 908 | h = _fileheader(path) |
|
910 | 909 | size = len(h) |
|
911 | 910 | yield h |
|
912 | 911 | |
|
913 |
for |
|
|
914 | size += len(chunk) | |
|
915 |
|
|
|
912 | for delta in deltas: | |
|
913 | chunks = _revisiondeltatochunks(delta, self._builddeltaheader) | |
|
914 | for chunk in chunks: | |
|
915 | size += len(chunk) | |
|
916 | yield chunk | |
|
916 | 917 | |
|
917 | 918 | close = closechunk() |
|
918 | 919 | size += len(close) |
@@ -993,7 +994,7 b' class cgpacker(object):' | |||
|
993 | 994 | |
|
994 | 995 | gen = deltagroup( |
|
995 | 996 | self._repo, revs, cl, True, lookupcl, |
|
996 |
self._deltaparentfn, |
|
|
997 | self._deltaparentfn, | |
|
997 | 998 | ellipses=self._ellipses, |
|
998 | 999 | units=_('changesets'), |
|
999 | 1000 | clrevtolocalrev={}, |
@@ -1080,16 +1081,16 b' class cgpacker(object):' | |||
|
1080 | 1081 | revs = _sortnodesnormal(store, prunednodes, |
|
1081 | 1082 | self._reorder) |
|
1082 | 1083 | |
|
1083 |
|
|
|
1084 | deltas = deltagroup( | |
|
1084 | 1085 | self._repo, revs, store, False, lookupfn, |
|
1085 |
self._deltaparentfn, |
|
|
1086 | self._deltaparentfn, | |
|
1086 | 1087 | ellipses=self._ellipses, |
|
1087 | 1088 | units=_('manifests'), |
|
1088 | 1089 | clrevtolocalrev=clrevtolocalrev, |
|
1089 | 1090 | fullclnodes=self._fullclnodes, |
|
1090 | 1091 | precomputedellipsis=self._precomputedellipsis) |
|
1091 | 1092 | |
|
1092 |
yield dir, |
|
|
1093 | yield dir, deltas | |
|
1093 | 1094 | |
|
1094 | 1095 | # The 'source' parameter is useful for extensions |
|
1095 | 1096 | def generatefiles(self, changedfiles, commonrevs, source, |
@@ -1172,15 +1173,15 b' class cgpacker(object):' | |||
|
1172 | 1173 | |
|
1173 | 1174 | progress.update(i + 1, item=fname) |
|
1174 | 1175 | |
|
1175 |
|
|
|
1176 | deltas = deltagroup( | |
|
1176 | 1177 | self._repo, revs, filerevlog, False, lookupfilelog, |
|
1177 |
self._deltaparentfn, |
|
|
1178 | self._deltaparentfn, | |
|
1178 | 1179 | ellipses=self._ellipses, |
|
1179 | 1180 | clrevtolocalrev=clrevtolocalrev, |
|
1180 | 1181 | fullclnodes=self._fullclnodes, |
|
1181 | 1182 | precomputedellipsis=self._precomputedellipsis) |
|
1182 | 1183 | |
|
1183 |
yield fname, |
|
|
1184 | yield fname, deltas | |
|
1184 | 1185 | |
|
1185 | 1186 | progress.complete() |
|
1186 | 1187 |
General Comments 0
You need to be logged in to leave comments.
Login now