Patchwork D9831: exchangev2: avoid second look-up by node

login
register
mail settings
Submitter phabricator
Date Jan. 18, 2021, 11:51 p.m.
Message ID <differential-rev-PHID-DREV-ern2q5v6klafi5couzke-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48142/
State Superseded
Headers show

Comments

phabricator - Jan. 18, 2021, 11:51 p.m.
joerg.sonnenberger created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Accessing the revlog by node is slightly more expensive than by
  revision, so look up the revision first and use it afterwards.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/exchangev2.py

CHANGE DETAILS




To: joerg.sonnenberger, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/exchangev2.py b/mercurial/exchangev2.py
--- a/mercurial/exchangev2.py
+++ b/mercurial/exchangev2.py
@@ -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 = {}