[Updated] D12135: branchmap: don't add branch entries if there are no heads

av6 (Anton Shestakov) phabricator at mercurial-scm.org
Mon Feb 7 14:05:11 UTC 2022


Closed by commit rHG8b393f40a5e6: branchmap: don't add branch entries if there are no heads (authored by av6).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D12135?vs=32079&id=32084

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D12135/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D12135

AFFECTED FILES
  mercurial/branchmap.py

CHANGE DETAILS

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -519,7 +519,7 @@
             #   checks can be skipped. Otherwise, the ancestors of the
             #   "uncertain" set are removed from branchheads.
             #   This computation is heavy and avoided if at all possible.
-            bheads = self._entries.setdefault(branch, [])
+            bheads = self._entries.get(branch, [])
             bheadset = {cl.rev(node) for node in bheads}
             uncertain = set()
             for newrev in sorted(newheadrevs):
@@ -562,8 +562,8 @@
                     if floorrev <= max(uncertain):
                         ancestors = set(cl.ancestors(uncertain, floorrev))
                         bheadset -= ancestors
-            bheadrevs = sorted(bheadset)
-            self[branch] = [cl.node(rev) for rev in bheadrevs]
+            if bheadset:
+                self[branch] = [cl.node(rev) for rev in sorted(bheadset)]
             tiprev = max(newheadrevs)
             if tiprev > ntiprev:
                 ntiprev = tiprev



To: av6, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220207/16d60914/attachment-0002.html>


More information about the Mercurial-patches mailing list