Backed out changeset f28c52a9f7b4 stable
authorRaphaël Gomès <rgomes@octobus.net>
Mon, 08 Jul 2024 16:20:04 +0200
branchstable
changeset 51658 a0f1378b932e
parent 51657 66aa49e6e5d1
child 51659 d9faa71a57f6
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.
mercurial/bundle2.py
mercurial/exchange.py
mercurial/obsolete.py
mercurial/obsutil.py
--- a/mercurial/bundle2.py	Mon Jul 08 16:19:33 2024 +0200
+++ b/mercurial/bundle2.py	Mon Jul 08 16:20:04 2024 +0200
@@ -1788,7 +1788,7 @@
         addpartrevbranchcache(repo, bundler, outgoing)
 
     if opts.get(b'obsolescence', False):
-        obsmarkers = repo.obsstore.relevantmarkers(nodes=outgoing.missing)
+        obsmarkers = repo.obsstore.relevantmarkers(outgoing.missing)
         buildobsmarkerspart(
             bundler,
             obsmarkers,
--- a/mercurial/exchange.py	Mon Jul 08 16:19:33 2024 +0200
+++ b/mercurial/exchange.py	Mon Jul 08 16:20:04 2024 +0200
@@ -703,8 +703,8 @@
     repo = pushop.repo
     # very naive computation, that can be quite expensive on big repo.
     # However: evolution is currently slow on them anyway.
-    revs = repo.revs(b'::%ln', pushop.futureheads)
-    pushop.outobsmarkers = pushop.repo.obsstore.relevantmarkers(revs=revs)
+    nodes = (c.node() for c in repo.set(b'::%ln', pushop.futureheads))
+    pushop.outobsmarkers = pushop.repo.obsstore.relevantmarkers(nodes)
 
 
 @pushdiscovery(b'bookmarks')
@@ -2605,8 +2605,8 @@
     if kwargs.get('obsmarkers', False):
         if heads is None:
             heads = repo.heads()
-        revs = repo.revs(b'::%ln', heads)
-        markers = repo.obsstore.relevantmarkers(revs=revs)
+        subset = [c.node() for c in repo.set(b'::%ln', heads)]
+        markers = repo.obsstore.relevantmarkers(subset)
         markers = obsutil.sortedmarkers(markers)
         bundle2.buildobsmarkerspart(bundler, markers)
 
--- a/mercurial/obsolete.py	Mon Jul 08 16:19:33 2024 +0200
+++ b/mercurial/obsolete.py	Mon Jul 08 16:20:04 2024 +0200
@@ -771,11 +771,10 @@
             _addchildren(self.children, markers)
         _checkinvalidmarkers(self.repo, markers)
 
-    def relevantmarkers(self, nodes=None, revs=None):
-        """return a set of all obsolescence markers relevant to a set of
-        nodes or revisions.
+    def relevantmarkers(self, nodes):
+        """return a set of all obsolescence markers relevant to a set of nodes.
 
-        "relevant" to a set of nodes or revisions mean:
+        "relevant" to a set of nodes mean:
 
         - marker that use this changeset as successor
         - prune marker of direct children on this changeset
@@ -783,24 +782,10 @@
           markers
 
         It is a set so you cannot rely on order."""
-        if nodes is None:
-            nodes = set()
-        if revs is None:
-            revs = set()
 
-        get_rev = self.repo.unfiltered().changelog.index.get_rev
-        pendingnodes = set()
-        for marker in self._all:
-            for node in (marker[0],) + marker[1] + (marker[5] or ()):
-                if node in nodes:
-                    pendingnodes.add(node)
-                elif revs:
-                    rev = get_rev(node)
-                    if rev is not None and rev in revs:
-                        pendingnodes.add(node)
+        pendingnodes = set(nodes)
         seenmarkers = set()
-        seenmarkers = set()
-        seennodes = set()
+        seennodes = set(pendingnodes)
         precursorsmarkers = self.predecessors
         succsmarkers = self.successors
         children = self.children
--- a/mercurial/obsutil.py	Mon Jul 08 16:19:33 2024 +0200
+++ b/mercurial/obsutil.py	Mon Jul 08 16:20:04 2024 +0200
@@ -108,7 +108,7 @@
     elif exclusive:
         rawmarkers = exclusivemarkers(repo, nodes)
     else:
-        rawmarkers = repo.obsstore.relevantmarkers(nodes=nodes)
+        rawmarkers = repo.obsstore.relevantmarkers(nodes)
 
     for markerdata in rawmarkers:
         yield marker(repo, markerdata)