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.
--- 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',