comparison mercurial/changelog.py @ 46197:2607a9346398

branchmap: micro-optimize branchinfo 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. Differential Revision: https://phab.mercurial-scm.org/D9626
author Joerg Sonnenberger <joerg@bec.de>
date Thu, 17 Dec 2020 13:29:50 +0100
parents 89a2afe31e82
children cad17d50736c
comparison
equal deleted inserted replaced
46196:96b73671753a 46197:2607a9346398
599 def branchinfo(self, rev): 599 def branchinfo(self, rev):
600 """return the branch name and open/close state of a revision 600 """return the branch name and open/close state of a revision
601 601
602 This function exists because creating a changectx object 602 This function exists because creating a changectx object
603 just to access this is costly.""" 603 just to access this is costly."""
604 extra = self.read(rev)[5] 604 extra = self.changelogrevision(rev).extra
605 return encoding.tolocal(extra.get(b"branch")), b'close' in extra 605 return encoding.tolocal(extra.get(b"branch")), b'close' in extra
606 606
607 def _nodeduplicatecallback(self, transaction, node): 607 def _nodeduplicatecallback(self, transaction, node):
608 # keep track of revisions that got "re-added", eg: unbunde of know rev. 608 # keep track of revisions that got "re-added", eg: unbunde of know rev.
609 # 609 #