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