Patchwork D9626: branchmap: micro-optimize branchinfo

login
register
mail settings
Submitter phabricator
Date Dec. 17, 2020, 12:30 p.m.
Message ID <differential-rev-PHID-DREV-o2h5v6im6xzl4grkum2s-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47924/
State Superseded
Headers show

Comments

phabricator - Dec. 17, 2020, 12:30 p.m.
joerg.sonnenberger created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  changelogrevision() is supposed to be used if not all data of
  changelog.read is used. This is the case here as only the extra field is
  used. This also improves extensibility as at least hgext.git doesn't
  implement changelog.read.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/changelog.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -601,7 +601,7 @@ 
 
         This function exists because creating a changectx object
         just to access this is costly."""
-        extra = self.read(rev)[5]
+        extra = self.changelogrevision(rev).extra
         return encoding.tolocal(extra.get(b"branch")), b'close' in extra
 
     def _nodeduplicatecallback(self, transaction, node):