exchangev2: avoid second look-up by node
authorJoerg Sonnenberger <joerg@bec.de>
Tue, 19 Jan 2021 00:20:42 +0100
changeset 46358 009130064813
parent 46357 72f5280e33b6
child 46359 0600e8467101
exchangev2: avoid second look-up by node Accessing the revlog by node is slightly more expensive than by revision, so look up the revision first and use it afterwards. Differential Revision: https://phab.mercurial-scm.org/D9831
mercurial/exchangev2.py
--- a/mercurial/exchangev2.py	Tue Jan 19 00:18:39 2021 +0100
+++ b/mercurial/exchangev2.py	Tue Jan 19 00:20:42 2021 +0100
@@ -364,12 +364,13 @@
     def onchangeset(cl, node):
         progress.increment()
 
-        revision = cl.changelogrevision(node)
+        rev = cl.rev(node)
+        revision = cl.changelogrevision(rev)
         added.append(node)
 
         # We need to preserve the mapping of changelog revision to node
         # so we can set the linkrev accordingly when manifests are added.
-        manifestnodes[cl.rev(node)] = revision.manifest
+        manifestnodes[rev] = revision.manifest
 
     nodesbyphase = {phase: set() for phase in phases.phasenames.values()}
     remotebookmarks = {}