Patchwork D7318: revlog: deprecate the _nodecache attribute (API)

login
register
mail settings
Submitter phabricator
Date Nov. 8, 2019, 9:31 a.m.
Message ID <differential-rev-PHID-DREV-jg3cb4zocdletlkzvc66-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42914/
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
  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.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  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
@@ -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)