changeset 43526:e258ad110488

revlog: no longer return the nodemap after parsing Now that both pure and cext version have a `nodemap` attribute, we do not need to return the `nodemap` object after parsing. This work is part of a refactoring to unify the revlog index and the nodemap. This unification prepare the use of a persistent nodemap. Differential Revision: https://phab.mercurial-scm.org/D7314
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 06 Nov 2019 14:13:19 +0100
parents 845e5b313783
children 43424f03d9a4
files contrib/perf.py mercurial/revlog.py
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Wed Nov 06 14:13:19 2019 +0100
+++ b/contrib/perf.py	Wed Nov 06 14:13:19 2019 +0100
@@ -2592,7 +2592,7 @@
                 index[rev]
 
     def resolvenode(node):
-        nodemap = revlogio.parseindex(data, inline)[1]
+        nodemap = getattr(revlogio.parseindex(data, inline)[0], 'nodemap', None)
         # This only works for the C code.
         if nodemap is None:
             return
@@ -2603,7 +2603,7 @@
             pass
 
     def resolvenodes(nodes, count=1):
-        nodemap = revlogio.parseindex(data, inline)[1]
+        nodemap = getattr(revlogio.parseindex(data, inline)[0], 'nodemap', None)
         if nodemap is None:
             return
 
--- a/mercurial/revlog.py	Wed Nov 06 14:13:19 2019 +0100
+++ b/mercurial/revlog.py	Wed Nov 06 14:13:19 2019 +0100
@@ -252,7 +252,7 @@
             n += 1
 
         index = revlogoldindex(index)
-        return index, index.nodemap, None
+        return index, None
 
     def packentry(self, entry, node, version, rev):
         if gettype(entry[0]):
@@ -299,7 +299,7 @@
     def parseindex(self, data, inline):
         # call the C implementation to parse the index data
         index, cache = parsers.parse_index2(data, inline)
-        return index, index.nodemap, cache
+        return index, cache
 
     def packentry(self, entry, node, version, rev):
         p = indexformatng_pack(*entry)
@@ -552,8 +552,8 @@
             raise error.RevlogError(
                 _(b"index %s is corrupted") % self.indexfile
             )
-        self.index, nodemap, self._chunkcache = d
-        self.nodemap = self._nodecache = nodemap
+        self.index, self._chunkcache = d
+        self.nodemap = self._nodecache = self.index.nodemap
         if not self._chunkcache:
             self._chunkclear()
         # revnum -> (chain-length, sum-delta-length)