diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -418,6 +418,8 @@ self._filteredrevs = frozenset() self._filteredrevs_hashcache = {} self._copiesstorage = opener.options.get(b'copies-storage') + self._changelogrevision_cache = None + self._changelogrevision_key = None @property def filteredrevs(self): @@ -521,10 +523,15 @@ def changelogrevision(self, nodeorrev): """Obtain a ``changelogrevision`` for a node or revision.""" + if nodeorrev == self._changelogrevision_key: + return self._changelogrevision_cache text, sidedata = self._revisiondata(nodeorrev) - return changelogrevision( + cr = changelogrevision( text, sidedata, self._copiesstorage == b'changeset-sidedata' ) + self._changelogrevision_cache = cr + self._changelogrevision_key = nodeorrev + return cr def readfiles(self, node): """