[Request] [+ ] D12135: branchmap: don't add branch entries if there are no heads
av6 (Anton Shestakov)
phabricator at mercurial-scm.org
Mon Feb 7 06:41:12 UTC 2022
av6 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
We definitely don't want any empty entries to be present in repo.branchmap()
just for the sake of not breaking test-notify.t.
No test changes required because the previous patch made notify extension to
not raise any tracebacks in case of RepoLookupErrors.
REPOSITORY
rHG Mercurial
BRANCH
default
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
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20220207/9d57ecb7/attachment.html>
More information about the Mercurial-patches
mailing list