Mercurial > hg-stable
changeset 47182:cacb08f357ed
revlog: define the actual index and datafile at loading time
This is just code movement, to make the code closer to where we actually use it
and where it will be defined in the future.
Differential Revision: https://phab.mercurial-scm.org/D10594
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 03 May 2021 12:25:45 +0200 |
parents | 88bd08a6830f |
children | a13f72b9ccfb |
files | mercurial/revlog.py |
diffstat | 1 files changed, 16 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Mon May 03 12:25:34 2021 +0200 +++ b/mercurial/revlog.py Mon May 03 12:25:45 2021 +0200 @@ -315,18 +315,8 @@ self.radix = radix - if postfix is None: - indexfile = b'%s.i' % self.radix - datafile = b'%s.d' % self.radix - elif postfix == b'a': - indexfile = b'%s.i.a' % self.radix - datafile = b'%s.d' % self.radix - else: - indexfile = b'%s.i.%s' % (self.radix, postfix) - datafile = b'%s.d.%s' % (self.radix, postfix) - - self._indexfile = indexfile - self._datafile = datafile + self._indexfile = None + self._datafile = None self._nodemap_file = None self.postfix = postfix self.opener = opener @@ -459,6 +449,20 @@ def _loadindex(self): newversionflags, mmapindexthreshold, force_nodemap = self._init_opts() + + if self.postfix is None: + index_file = b'%s.i' % self.radix + data_file = b'%s.d' % self.radix + elif self.postfix == b'a': + index_file = b'%s.i.a' % self.radix + data_file = b'%s.d' % self.radix + else: + index_file = b'%s.i.%s' % (self.radix, self.postfix) + data_file = b'%s.d.%s' % (self.radix, self.postfix) + + self._indexfile = index_file + self._datafile = data_file + indexdata = b'' self._initempty = True try: