comparison mercurial/obsolete.py @ 51661:a0f1378b932e stable

Backed out changeset f28c52a9f7b4 This backout and the previous are due to a large performance regression detected in repositories with a lot of obsmarkers when performing a clone. A better fix will come along at the start of the next cycle.
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 08 Jul 2024 16:20:04 +0200
parents 66aa49e6e5d1
children b8647465b59a 493034cc3265 e68fe567a780
comparison
equal deleted inserted replaced
51660:66aa49e6e5d1 51661:a0f1378b932e
769 _addpredecessors(self.predecessors, markers) 769 _addpredecessors(self.predecessors, markers)
770 if self._cached('children'): 770 if self._cached('children'):
771 _addchildren(self.children, markers) 771 _addchildren(self.children, markers)
772 _checkinvalidmarkers(self.repo, markers) 772 _checkinvalidmarkers(self.repo, markers)
773 773
774 def relevantmarkers(self, nodes=None, revs=None): 774 def relevantmarkers(self, nodes):
775 """return a set of all obsolescence markers relevant to a set of 775 """return a set of all obsolescence markers relevant to a set of nodes.
776 nodes or revisions. 776
777 777 "relevant" to a set of nodes mean:
778 "relevant" to a set of nodes or revisions mean:
779 778
780 - marker that use this changeset as successor 779 - marker that use this changeset as successor
781 - prune marker of direct children on this changeset 780 - prune marker of direct children on this changeset
782 - recursive application of the two rules on predecessors of these 781 - recursive application of the two rules on predecessors of these
783 markers 782 markers
784 783
785 It is a set so you cannot rely on order.""" 784 It is a set so you cannot rely on order."""
786 if nodes is None: 785
787 nodes = set() 786 pendingnodes = set(nodes)
788 if revs is None:
789 revs = set()
790
791 get_rev = self.repo.unfiltered().changelog.index.get_rev
792 pendingnodes = set()
793 for marker in self._all:
794 for node in (marker[0],) + marker[1] + (marker[5] or ()):
795 if node in nodes:
796 pendingnodes.add(node)
797 elif revs:
798 rev = get_rev(node)
799 if rev is not None and rev in revs:
800 pendingnodes.add(node)
801 seenmarkers = set() 787 seenmarkers = set()
802 seenmarkers = set() 788 seennodes = set(pendingnodes)
803 seennodes = set()
804 precursorsmarkers = self.predecessors 789 precursorsmarkers = self.predecessors
805 succsmarkers = self.successors 790 succsmarkers = self.successors
806 children = self.children 791 children = self.children
807 while pendingnodes: 792 while pendingnodes:
808 direct = set() 793 direct = set()