changeset 43578:6e3e3e5446ba

revlog: deprecate the _nodecache attribute (API) This attribute have been the same object for a long time. Code should directly access the nodemap in case of need. (Or the final API when this will be done). 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/D7318
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 02 Nov 2019 15:46:47 +0100
parents bf176127033a
children dcf9826c8d8c
files mercurial/revlog.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Sat Nov 02 15:25:31 2019 +0100
+++ b/mercurial/revlog.py	Sat Nov 02 15:46:47 2019 +0100
@@ -388,7 +388,6 @@
         # Mapping of partial identifiers to full nodes.
         self._pcache = {}
         # Mapping of revision integer to full node.
-        self._nodecache = None
         self._nodepos = None
         self._compengine = b'zlib'
         self._compengineopts = {}
@@ -553,7 +552,7 @@
                 _(b"index %s is corrupted") % self.indexfile
             )
         self.index, self._chunkcache = d
-        self.nodemap = self._nodecache = self.index.nodemap
+        self.nodemap = self.index.nodemap
         if not self._chunkcache:
             self._chunkclear()
         # revnum -> (chain-length, sum-delta-length)
@@ -632,6 +631,12 @@
             self.rev(node0)
         return self.index.nodemap
 
+    @property
+    def _nodecache(self):
+        msg = "revlog._nodecache is deprecated, use revlog.index.nodemap"
+        util.nouideprecwarn(msg, b'5.3', stacklevel=2)
+        return self.index.nodemap
+
     def hasnode(self, node):
         try:
             self.rev(node)