Patchwork D7314: revlog: no longer return the nodemap after parsing

login
register
mail settings
Submitter phabricator
Date Nov. 8, 2019, 9:31 a.m.
Message ID <differential-rev-PHID-DREV-mpywufilkmoqc2i7olmr-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42913/
State Superseded
Headers show

Comments

phabricator - Nov. 8, 2019, 9:31 a.m.
marmoute created this revision.
Herald added a reviewer: indygreg.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/perf.py
  mercurial/revlog.py

CHANGE DETAILS




To: marmoute, indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -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)
diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -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