branchcache: gather newly closed head in a dedicated set
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 06 Mar 2024 16:10:44 +0100
changeset 51534 767b62cb728e
parent 51533 50850689d3c0
child 51535 03247e37ccf7
branchcache: gather newly closed head in a dedicated set This is part of a series to more clearly split the update in two step. This will allow us to introduce a fast path during update in a future changeset.
mercurial/branchmap.py
--- a/mercurial/branchmap.py	Wed Mar 06 16:09:42 2024 +0100
+++ b/mercurial/branchmap.py	Wed Mar 06 16:10:44 2024 +0100
@@ -288,6 +288,7 @@
         obsrevs = obsolete.getrevs(repo, b'obsolete')
         # collect new branch entries
         newbranches = {}
+        new_closed = set()
         obs_ignored = set()
         getbranchinfo = repo.revbranchcache().branchinfo
         max_rev = -1
@@ -301,7 +302,7 @@
             branch, closesbranch = getbranchinfo(r)
             newbranches.setdefault(branch, []).append(r)
             if closesbranch:
-                self._closednodes.add(cl.node(r))
+                new_closed.add(r)
         if max_rev < 0:
             msg = "running branchcache.update without revision to update"
             raise error.ProgrammingError(msg)
@@ -391,6 +392,8 @@
             if bheadset:
                 self[branch] = [cl.node(rev) for rev in sorted(bheadset)]
 
+        self._closednodes.update(cl.node(rev) for rev in new_closed)
+
         duration = util.timer() - starttime
         repo.ui.log(
             b'branchcache',