changeset 51534:767b62cb728e

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 06 Mar 2024 16:10:44 +0100
parents 50850689d3c0
children 03247e37ccf7
files mercurial/branchmap.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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',