Patchwork D10590: revlog: rename `nodemap_file` to `_nodemap_file`

login
register
mail settings
Submitter phabricator
Date May 3, 2021, 12:07 p.m.
Message ID <differential-rev-PHID-DREV-2md5y2vljaoasg3la2yc-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48909/
State Superseded
Headers show

Comments

phabricator - May 3, 2021, 12:07 p.m.
marmoute created this revision.
Herald added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Same reasoning as for `indexfile and datafile`, lets hide these implementation
  details.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/revlog.py
  mercurial/revlogutils/nodemap.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/revlogutils/nodemap.py b/mercurial/revlogutils/nodemap.py
--- a/mercurial/revlogutils/nodemap.py
+++ b/mercurial/revlogutils/nodemap.py
@@ -28,9 +28,9 @@ 
 
 def persisted_data(revlog):
     """read the nodemap for a revlog from disk"""
-    if revlog.nodemap_file is None:
+    if revlog._nodemap_file is None:
         return None
-    pdata = revlog.opener.tryread(revlog.nodemap_file)
+    pdata = revlog.opener.tryread(revlog._nodemap_file)
     if not pdata:
         return None
     offset = 0
@@ -77,11 +77,11 @@ 
     """
     if revlog._inline:
         return  # inlined revlog are too small for this to be relevant
-    if revlog.nodemap_file is None:
+    if revlog._nodemap_file is None:
         return  # we do not use persistent_nodemap on this revlog
 
     # we need to happen after the changelog finalization, in that use "cl-"
-    callback_id = b"nm-revlog-persistent-nodemap-%s" % revlog.nodemap_file
+    callback_id = b"nm-revlog-persistent-nodemap-%s" % revlog._nodemap_file
     if tr.hasfinalize(callback_id):
         return  # no need to register again
     tr.addpending(
@@ -123,7 +123,7 @@ 
     """
     if revlog._inline:
         return  # inlined revlog are too small for this to be relevant
-    if revlog.nodemap_file is None:
+    if revlog._nodemap_file is None:
         return  # we do not use persistent_nodemap on this revlog
 
     notr = _NoTransaction()
@@ -134,10 +134,10 @@ 
 
 def delete_nodemap(tr, repo, revlog):
     """ Delete nodemap data on disk for a given revlog"""
-    if revlog.nodemap_file is None:
+    if revlog._nodemap_file is None:
         msg = "calling persist nodemap on a revlog without the feature enabled"
         raise error.ProgrammingError(msg)
-    repo.svfs.unlink(revlog.nodemap_file)
+    repo.svfs.unlink(revlog._nodemap_file)
 
 
 def persist_nodemap(tr, revlog, pending=False, force=False):
@@ -146,9 +146,9 @@ 
         raise error.ProgrammingError(
             "cannot persist nodemap of a filtered changelog"
         )
-    if revlog.nodemap_file is None:
+    if revlog._nodemap_file is None:
         if force:
-            revlog.nodemap_file = get_nodemap_file(revlog)
+            revlog._nodemap_file = get_nodemap_file(revlog)
         else:
             msg = "calling persist nodemap on a revlog without the feature enabled"
             raise error.ProgrammingError(msg)
@@ -225,7 +225,7 @@ 
     target_docket.tip_node = revlog.node(target_docket.tip_rev)
     # EXP-TODO: if this is a cache, this should use a cache vfs, not a
     # store vfs
-    file_path = revlog.nodemap_file
+    file_path = revlog._nodemap_file
     if pending:
         file_path += b'.a'
         tr.registertmp(file_path)
@@ -248,7 +248,7 @@ 
             for oldfile in olds:
                 realvfs.tryunlink(oldfile)
 
-        callback_id = b"revlog-cleanup-nodemap-%s" % revlog.nodemap_file
+        callback_id = b"revlog-cleanup-nodemap-%s" % revlog._nodemap_file
         tr.addpostclose(callback_id, cleanup)
 
 
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -327,11 +327,11 @@ 
 
         self._indexfile = indexfile
         self._datafile = datafile
-        self.nodemap_file = None
+        self._nodemap_file = None
         self.postfix = postfix
         self.opener = opener
         if persistentnodemap:
-            self.nodemap_file = nodemaputil.get_nodemap_file(self)
+            self._nodemap_file = nodemaputil.get_nodemap_file(self)
 
         assert target[0] in ALL_KINDS
         assert len(target) == 2
@@ -536,14 +536,14 @@ 
         self._storedeltachains = True
 
         devel_nodemap = (
-            self.nodemap_file
+            self._nodemap_file
             and force_nodemap
             and parse_index_v1_nodemap is not None
         )
 
         use_rust_index = False
         if rustrevlog is not None:
-            if self.nodemap_file is not None:
+            if self._nodemap_file is not None:
                 use_rust_index = True
             else:
                 use_rust_index = self.opener.options.get(b'rust.index')
@@ -562,7 +562,7 @@ 
             index, _chunkcache = d
             use_nodemap = (
                 not self._inline
-                and self.nodemap_file is not None
+                and self._nodemap_file is not None
                 and util.safehasattr(index, 'update_nodemap_data')
             )
             if use_nodemap:
@@ -698,7 +698,7 @@ 
         return True
 
     def update_caches(self, transaction):
-        if self.nodemap_file is not None:
+        if self._nodemap_file is not None:
             if transaction is None:
                 nodemaputil.update_persistent_nodemap(self)
             else:
@@ -715,7 +715,7 @@ 
         # end up having to refresh it here.
         use_nodemap = (
             not self._inline
-            and self.nodemap_file is not None
+            and self._nodemap_file is not None
             and util.safehasattr(self.index, 'update_nodemap_data')
         )
         if use_nodemap: