##// END OF EJS Templates
changegroup: pass all state into group()...
Gregory Szorc -
r39044:8c84f1ef default
parent child Browse files
Show More
@@ -751,8 +751,10 b' class cgpacker(object):'
751 751 else:
752 752 self._verbosenote = lambda s: None
753 753
754 def group(self, revs, store, ischangelog, lookup, units=None,
755 clrevtolocalrev=None):
754 def group(self, repo, revs, store, ischangelog, lookup, deltaparentfn,
755 deltaheaderfn, units=None,
756 ellipses=False, clrevtolocalrev=None, fullclnodes=None,
757 precomputedellipsis=None):
756 758 """Calculate a delta group, yielding a sequence of changegroup chunks
757 759 (strings).
758 760
@@ -771,7 +773,7 b' class cgpacker(object):'
771 773 yield closechunk()
772 774 return
773 775
774 cl = self._repo.changelog
776 cl = repo.changelog
775 777
776 778 # add the parent of the first rev
777 779 p = store.parentrevs(revs[0])[0]
@@ -780,38 +782,38 b' class cgpacker(object):'
780 782 # build deltas
781 783 progress = None
782 784 if units is not None:
783 progress = self._repo.ui.makeprogress(_('bundling'), unit=units,
784 total=(len(revs) - 1))
785 progress = repo.ui.makeprogress(_('bundling'), unit=units,
786 total=(len(revs) - 1))
785 787 for r in pycompat.xrange(len(revs) - 1):
786 788 if progress:
787 789 progress.update(r + 1)
788 790 prev, curr = revs[r], revs[r + 1]
789 791 linknode = lookup(store.node(curr))
790 792
791 if self._ellipses:
793 if ellipses:
792 794 linkrev = cl.rev(linknode)
793 795 clrevtolocalrev[linkrev] = curr
794 796
795 797 # This is a node to send in full, because the changeset it
796 798 # corresponds to was a full changeset.
797 if linknode in self._fullclnodes:
799 if linknode in fullclnodes:
798 800 delta = _revisiondeltanormal(store, curr, prev, linknode,
799 self._deltaparentfn)
800 elif linkrev not in self._precomputedellipsis:
801 deltaparentfn)
802 elif linkrev not in precomputedellipsis:
801 803 delta = None
802 804 else:
803 805 delta = _revisiondeltanarrow(
804 806 cl, store, ischangelog, curr, linkrev, linknode,
805 clrevtolocalrev, self._fullclnodes,
806 self._precomputedellipsis)
807 clrevtolocalrev, fullclnodes,
808 precomputedellipsis)
807 809 else:
808 810 delta = _revisiondeltanormal(store, curr, prev, linknode,
809 self._deltaparentfn)
811 deltaparentfn)
810 812
811 813 if not delta:
812 814 continue
813 815
814 meta = self._builddeltaheader(delta)
816 meta = deltaheaderfn(delta)
815 817 l = len(meta) + sum(len(x) for x in delta.deltachunks)
816 818 yield chunkheader(l)
817 819 yield meta
@@ -956,8 +958,13 b' class cgpacker(object):'
956 958 'clrevtomanifestrev': clrevtomanifestrev,
957 959 }
958 960
959 gen = self.group(revs, cl, True, lookupcl, units=_('changesets'),
960 clrevtolocalrev={})
961 gen = self.group(self._repo, revs, cl, True, lookupcl,
962 self._deltaparentfn, self._builddeltaheader,
963 ellipses=self._ellipses,
964 units=_('changesets'),
965 clrevtolocalrev={},
966 fullclnodes=self._fullclnodes,
967 precomputedellipsis=self._precomputedellipsis)
961 968
962 969 return state, gen
963 970
@@ -1046,9 +1053,16 b' class cgpacker(object):'
1046 1053 size += len(chunk)
1047 1054 yield chunk
1048 1055
1049 for chunk in self.group(revs, store, False, lookupfn,
1050 units=_('manifests'),
1051 clrevtolocalrev=clrevtolocalrev):
1056 it = self.group(
1057 self._repo, revs, store, False, lookupfn,
1058 self._deltaparentfn, self._builddeltaheader,
1059 ellipses=self._ellipses,
1060 units=_('manifests'),
1061 clrevtolocalrev=clrevtolocalrev,
1062 fullclnodes=self._fullclnodes,
1063 precomputedellipsis=self._precomputedellipsis)
1064
1065 for chunk in it:
1052 1066 size += len(chunk)
1053 1067 yield chunk
1054 1068
@@ -1138,8 +1152,16 b' class cgpacker(object):'
1138 1152 h = _fileheader(fname)
1139 1153 size = len(h)
1140 1154 yield h
1141 for chunk in self.group(revs, filerevlog, False, lookupfilelog,
1142 clrevtolocalrev=clrevtolocalrev):
1155
1156 it = self.group(
1157 self._repo, revs, filerevlog, False, lookupfilelog,
1158 self._deltaparentfn, self._builddeltaheader,
1159 ellipses=self._ellipses,
1160 clrevtolocalrev=clrevtolocalrev,
1161 fullclnodes=self._fullclnodes,
1162 precomputedellipsis=self._precomputedellipsis)
1163
1164 for chunk in it:
1143 1165 size += len(chunk)
1144 1166 yield chunk
1145 1167 self._verbosenote(_('%8.i %s\n') % (size, fname))
General Comments 0
You need to be logged in to leave comments. Login now