Mercurial > hg
changeset 47144:b6e1fe7ac24b
revlog: split the option initialisation in its own method
The part of the code is huge, keeping it separated will keep the `_loadindex`
method simpler and help keeping logic well insulated.
Differential Revision: https://phab.mercurial-scm.org/D10570
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 03 May 2021 12:21:35 +0200 |
parents | 47ffc754989a |
children | c6b8d5d91e73 |
files | mercurial/revlog.py |
diffstat | 1 files changed, 23 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Mon May 03 12:21:25 2021 +0200 +++ b/mercurial/revlog.py Mon May 03 12:21:35 2021 +0200 @@ -363,7 +363,22 @@ self._concurrencychecker = concurrencychecker - def _loadindex(self): + def _init_opts(self): + """process options (from above/config) to setup associated default revlog mode + + These values might be affected when actually reading on disk information. + + The relevant values are returned for use in _loadindex(). + + * newversionflags: + version header to use if we need to create a new revlog + + * mmapindexthreshold: + minimal index size for start to use mmap + + * force_nodemap: + force the usage of a "development" version of the nodemap code + """ mmapindexthreshold = None opts = self.opener.options @@ -426,7 +441,12 @@ _(b'revlog chunk cache size %r is not a power of 2') % self._chunkcachesize ) - + force_nodemap = opts.get(b'devel-force-nodemap', False) + return newversionflags, mmapindexthreshold, force_nodemap + + def _loadindex(self): + + newversionflags, mmapindexthreshold, force_nodemap = self._init_opts() indexdata = b'' self._initempty = True try: @@ -505,7 +525,7 @@ devel_nodemap = ( self.nodemap_file - and opts.get(b'devel-force-nodemap', False) + and force_nodemap and parse_index_v1_nodemap is not None )