##// END OF EJS Templates
changegroup: pass clrevtolocalrev to each group...
Gregory Szorc -
r39037:a6e1ff40 default
parent child Browse files
Show More
@@ -658,17 +658,11 b' class cgpacker(object):'
658 658 else:
659 659 self._verbosenote = lambda s: None
660 660
661 # Maps CL revs to per-revlog revisions. Cleared in close() at
662 # the end of each group.
663 self._clrevtolocalrev = {}
664
665 661 def _close(self):
666 # Ellipses serving mode.
667 self._clrevtolocalrev.clear()
668
669 662 return closechunk()
670 663
671 def group(self, revs, store, ischangelog, lookup, units=None):
664 def group(self, revs, store, ischangelog, lookup, units=None,
665 clrevtolocalrev=None):
672 666 """Calculate a delta group, yielding a sequence of changegroup chunks
673 667 (strings).
674 668
@@ -706,7 +700,7 b' class cgpacker(object):'
706 700
707 701 if self._ellipses:
708 702 linkrev = cl.rev(linknode)
709 self._clrevtolocalrev[linkrev] = curr
703 clrevtolocalrev[linkrev] = curr
710 704
711 705 # This is a node to send in full, because the changeset it
712 706 # corresponds to was a full changeset.
@@ -717,7 +711,8 b' class cgpacker(object):'
717 711 delta = None
718 712 else:
719 713 delta = self._revisiondeltanarrow(store, ischangelog,
720 curr, linkrev, linknode)
714 curr, linkrev, linknode,
715 clrevtolocalrev)
721 716 else:
722 717 delta = _revisiondeltanormal(store, curr, prev, linknode,
723 718 self._deltaparentfn)
@@ -746,7 +741,8 b' class cgpacker(object):'
746 741 rr, rl = store.rev, store.linkrev
747 742 return [n for n in missing if rl(rr(n)) not in commonrevs]
748 743
749 def _packmanifests(self, dir, dirlog, revs, lookuplinknode):
744 def _packmanifests(self, dir, dirlog, revs, lookuplinknode,
745 clrevtolocalrev):
750 746 """Pack manifests into a changegroup stream.
751 747
752 748 Encodes the directory name in the output so multiple manifests
@@ -757,7 +753,8 b' class cgpacker(object):'
757 753 yield _fileheader(dir)
758 754
759 755 for chunk in self.group(revs, dirlog, False, lookuplinknode,
760 units=_('manifests')):
756 units=_('manifests'),
757 clrevtolocalrev=clrevtolocalrev):
761 758 yield chunk
762 759
763 760 def generate(self, commonrevs, clnodes, fastpathlinkrev, source):
@@ -780,9 +777,6 b' class cgpacker(object):'
780 777 mfs = clstate['mfs']
781 778 changedfiles = clstate['changedfiles']
782 779
783 if self._ellipses:
784 self._clrevtolocalrev = clstate['clrevtomanifestrev']
785
786 780 # We need to make sure that the linkrev in the changegroup refers to
787 781 # the first changeset that introduced the manifest or file revision.
788 782 # The fastpath is usually safer than the slowpath, because the filelogs
@@ -808,7 +802,8 b' class cgpacker(object):'
808 802 fnodes = {} # needed file nodes
809 803
810 804 for chunk in self.generatemanifests(commonrevs, clrevorder,
811 fastpathlinkrev, mfs, fnodes, source):
805 fastpathlinkrev, mfs, fnodes, source,
806 clstate['clrevtomanifestrev']):
812 807 yield chunk
813 808
814 809 mfdicts = None
@@ -895,12 +890,13 b' class cgpacker(object):'
895 890 'clrevtomanifestrev': clrevtomanifestrev,
896 891 }
897 892
898 gen = self.group(revs, cl, True, lookupcl, units=_('changesets'))
893 gen = self.group(revs, cl, True, lookupcl, units=_('changesets'),
894 clrevtolocalrev={})
899 895
900 896 return state, gen
901 897
902 898 def generatemanifests(self, commonrevs, clrevorder, fastpathlinkrev, mfs,
903 fnodes, source):
899 fnodes, source, clrevtolocalrev):
904 900 """Returns an iterator of changegroup chunks containing manifests.
905 901
906 902 `source` is unused here, but is used by extensions like remotefilelog to
@@ -969,7 +965,8 b' class cgpacker(object):'
969 965 revs = _sortnodesnormal(store, prunednodes,
970 966 self._reorder)
971 967
972 for x in self._packmanifests(dir, store, revs, lookupfn):
968 for x in self._packmanifests(dir, store, revs, lookupfn,
969 clrevtolocalrev):
973 970 size += len(x)
974 971 yield x
975 972 self._verbosenote(_('%8.i (manifests)\n') % size)
@@ -993,6 +990,8 b' class cgpacker(object):'
993 990 return dict((fnode(r), cln(lr))
994 991 for r, lr in revs if lr in clrevs)
995 992
993 clrevtolocalrev = {}
994
996 995 if self._isshallow:
997 996 # In a shallow clone, the linknodes callback needs to also include
998 997 # those file nodes that are in the manifests we sent but weren't
@@ -1007,7 +1006,7 b' class cgpacker(object):'
1007 1006 for c in commonctxs:
1008 1007 try:
1009 1008 fnode = c.filenode(fname)
1010 self._clrevtolocalrev[c.rev()] = flog.rev(fnode)
1009 clrevtolocalrev[c.rev()] = flog.rev(fnode)
1011 1010 except error.ManifestLookupError:
1012 1011 pass
1013 1012 links = normallinknodes(flog, fname)
@@ -1032,6 +1031,8 b' class cgpacker(object):'
1032 1031 raise error.Abort(_("empty or missing file data for %s") %
1033 1032 fname)
1034 1033
1034 clrevtolocalrev.clear()
1035
1035 1036 linkrevnodes = linknodes(filerevlog, fname)
1036 1037 # Lookup for filenodes, we collected the linkrev nodes above in the
1037 1038 # fastpath case and with lookupmf in the slowpath case.
@@ -1051,13 +1052,15 b' class cgpacker(object):'
1051 1052 h = _fileheader(fname)
1052 1053 size = len(h)
1053 1054 yield h
1054 for chunk in self.group(revs, filerevlog, False, lookupfilelog):
1055 for chunk in self.group(revs, filerevlog, False, lookupfilelog,
1056 clrevtolocalrev=clrevtolocalrev):
1055 1057 size += len(chunk)
1056 1058 yield chunk
1057 1059 self._verbosenote(_('%8.i %s\n') % (size, fname))
1058 1060 progress.complete()
1059 1061
1060 def _revisiondeltanarrow(self, store, ischangelog, rev, linkrev, linknode):
1062 def _revisiondeltanarrow(self, store, ischangelog, rev, linkrev, linknode,
1063 clrevtolocalrev):
1061 1064 linkparents = self._precomputedellipsis[linkrev]
1062 1065 def local(clrev):
1063 1066 """Turn a changelog revnum into a local revnum.
@@ -1089,8 +1092,8 b' class cgpacker(object):'
1089 1092 while walk:
1090 1093 p = walk[0]
1091 1094 walk = walk[1:]
1092 if p in self._clrevtolocalrev:
1093 return self._clrevtolocalrev[p]
1095 if p in clrevtolocalrev:
1096 return clrevtolocalrev[p]
1094 1097 elif p in self._fullclnodes:
1095 1098 walk.extend([pp for pp in self._repo.changelog.parentrevs(p)
1096 1099 if pp != nullrev])
General Comments 0
You need to be logged in to leave comments. Login now