changeset 40375:76d4272bd57b

branchmap: avoid changelog and attribute lookups in replacecache() This should make things faster. I'm not sure which operations would benefit from it though. Maybe branchmap application on clone? Differential Revision: https://phab.mercurial-scm.org/D5162
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 19 Oct 2018 16:34:45 +0200
parents 47c03042cd1d
children 801c8ca60af5
files mercurial/branchmap.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/branchmap.py	Fri Oct 19 16:16:17 2018 +0200
+++ b/mercurial/branchmap.py	Fri Oct 19 16:34:45 2018 +0200
@@ -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(),