##// END OF EJS Templates
changegroup: move revision maps to cgpacker...
Gregory Szorc -
r38942:0548f696 default
parent child Browse files
Show More
@@ -583,12 +583,21 b' class cgpacker(object):'
583 583 # controlled via arguments to group() that influence behavior.
584 584 self._changelogdone = False
585 585
586 # Maps CL revs to per-revlog revisions. Cleared in close() at
587 # the end of each group.
588 self._clrevtolocalrev = {}
589 self._nextclrevtolocalrev = {}
590
591 # Maps changelog nodes to changelog revs. Filled in once
592 # during changelog stage and then left unmodified.
593 self._clnodetorev = {}
594
586 595 def _close(self):
587 596 # Ellipses serving mode.
588 getattr(self, '_clrev_to_localrev', {}).clear()
589 if getattr(self, '_next_clrev_to_localrev', {}):
590 self._clrev_to_localrev = self._next_clrev_to_localrev
591 del self._next_clrev_to_localrev
597 self._clrevtolocalrev.clear()
598 if self._nextclrevtolocalrev:
599 self.clrevtolocalrev = self._nextclrevtolocalrev
600 self._nextclrevtolocalrev.clear()
592 601 self._changelogdone = True
593 602
594 603 return closechunk()
@@ -615,8 +624,8 b' class cgpacker(object):'
615 624 # order that they're introduced in dramatis personae by the
616 625 # changelog, so what we do is we sort the non-changelog histories
617 626 # by the order in which they are used by the changelog.
618 if util.safehasattr(self, '_full_nodes') and self._clnode_to_rev:
619 key = lambda n: self._clnode_to_rev[lookup(n)]
627 if util.safehasattr(self, '_full_nodes') and self._clnodetorev:
628 key = lambda n: self._clnodetorev[lookup(n)]
620 629 return [store.rev(n) for n in sorted(nodelist, key=key)]
621 630
622 631 # for generaldelta revlogs, we linearize the revs; this will both be
@@ -740,8 +749,8 b' class cgpacker(object):'
740 749 # manifest revnum to look up for this cl revnum. (Part of
741 750 # mapping changelog ellipsis parents to manifest ellipsis
742 751 # parents)
743 self._next_clrev_to_localrev.setdefault(cl.rev(x),
744 mfrevlog.rev(n))
752 self._nextclrevtolocalrev.setdefault(cl.rev(x),
753 mfrevlog.rev(n))
745 754 # We can't trust the changed files list in the changeset if the
746 755 # client requested a shallow clone.
747 756 if self._isshallow:
@@ -918,7 +927,7 b' class cgpacker(object):'
918 927 for c in commonctxs:
919 928 try:
920 929 fnode = c.filenode(fname)
921 self._clrev_to_localrev[c.rev()] = flog.rev(fnode)
930 self._clrevtolocalrev[c.rev()] = flog.rev(fnode)
922 931 except error.ManifestLookupError:
923 932 pass
924 933 links = oldlinknodes(flog, fname)
@@ -1063,12 +1072,12 b' class cgpacker(object):'
1063 1072 # build up some mapping information that's useful later. See
1064 1073 # the local() nested function below.
1065 1074 if not self._changelogdone:
1066 self._clnode_to_rev[linknode] = rev
1075 self._clnodetorev[linknode] = rev
1067 1076 linkrev = rev
1068 self._clrev_to_localrev[linkrev] = rev
1077 self._clrevtolocalrev[linkrev] = rev
1069 1078 else:
1070 linkrev = self._clnode_to_rev[linknode]
1071 self._clrev_to_localrev[linkrev] = rev
1079 linkrev = self._clnodetorev[linknode]
1080 self._clrevtolocalrev[linkrev] = rev
1072 1081
1073 1082 # This is a node to send in full, because the changeset it
1074 1083 # corresponds to was a full changeset.
@@ -1100,9 +1109,9 b' class cgpacker(object):'
1100 1109 # need to store some extra mapping information so that
1101 1110 # our contained ellipsis nodes will be able to resolve
1102 1111 # their parents.
1103 if clrev not in self._clrev_to_localrev:
1112 if clrev not in self._clrevtolocalrev:
1104 1113 clnode = store.node(clrev)
1105 self._clnode_to_rev[clnode] = clrev
1114 self._clnodetorev[clnode] = clrev
1106 1115 return clrev
1107 1116
1108 1117 # Walk the ellipsis-ized changelog breadth-first looking for a
@@ -1119,8 +1128,8 b' class cgpacker(object):'
1119 1128 while walk:
1120 1129 p = walk[0]
1121 1130 walk = walk[1:]
1122 if p in self._clrev_to_localrev:
1123 return self._clrev_to_localrev[p]
1131 if p in self._clrevtolocalrev:
1132 return self._clrevtolocalrev[p]
1124 1133 elif p in self._full_nodes:
1125 1134 walk.extend([pp for pp in self._repo.changelog.parentrevs(p)
1126 1135 if pp != nullrev])
@@ -1400,12 +1409,5 b' def _packellipsischangegroup(repo, commo'
1400 1409 packer._full_nodes = relevant_nodes
1401 1410 # Maps ellipsis revs to their roots at the changelog level.
1402 1411 packer._precomputed_ellipsis = ellipsisroots
1403 # Maps CL revs to per-revlog revisions. Cleared in close() at
1404 # the end of each group.
1405 packer._clrev_to_localrev = {}
1406 packer._next_clrev_to_localrev = {}
1407 # Maps changelog nodes to changelog revs. Filled in once
1408 # during changelog stage and then left unmodified.
1409 packer._clnode_to_rev = {}
1410 1412
1411 1413 return packer.generate(common, visitnodes, False, source)
General Comments 0
You need to be logged in to leave comments. Login now