Mercurial > hg-stable
changeset 47178:04f2f94836a5
revlog: rename `nodemap_file` to `_nodemap_file`
Same reasoning as for `indexfile and datafile`, lets hide these implementation
details.
Differential Revision: https://phab.mercurial-scm.org/D10590
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 03 May 2021 12:25:01 +0200 |
parents | 6bc7c467a7d1 |
children | 590f2364d33a |
files | mercurial/revlog.py mercurial/revlogutils/nodemap.py |
diffstat | 2 files changed, 19 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Mon May 03 12:24:50 2021 +0200 +++ b/mercurial/revlog.py Mon May 03 12:25:01 2021 +0200 @@ -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:
--- a/mercurial/revlogutils/nodemap.py Mon May 03 12:24:50 2021 +0200 +++ b/mercurial/revlogutils/nodemap.py Mon May 03 12:25:01 2021 +0200 @@ -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() @@ -133,11 +133,11 @@ def delete_nodemap(tr, repo, revlog): - """Delete nodemap data on disk for a given revlog""" - if revlog.nodemap_file is None: + """ Delete nodemap data on disk for a given revlog""" + 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)