D5162: branchmap: avoid changelog and attribute lookups in replacecache()
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Fri Oct 19 16:56:43 UTC 2018
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
This should make things faster. I'm not sure which operations would benefit
from it though. Maybe branchmap application on clone?
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D5162
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
@@ -130,18 +130,21 @@
This is likely only called during clone with a branch map from a remote.
"""
+ cl = repo.changelog
+ clrev = cl.rev
+ clbranchinfo = cl.branchinfo
rbheads = []
closed = []
for bheads in bm.itervalues():
rbheads.extend(bheads)
for h in bheads:
- r = repo.changelog.rev(h)
- b, c = repo.changelog.branchinfo(r)
+ r = clrev(h)
+ b, c = clbranchinfo(r)
if c:
closed.append(h)
if rbheads:
- rtiprev = max((int(repo.changelog.rev(node))
+ rtiprev = max((int(clrev(node))
for node in rbheads))
cache = branchcache(bm,
repo[rtiprev].node(),
To: indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list