Patchwork D10594: revlog: define the actual index and datafile at loading time

login
register
mail settings
Submitter phabricator
Date May 3, 2021, 12:07 p.m.
Message ID <differential-rev-PHID-DREV-goj6e5kvhqnrebfg4ljm-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48913/
State New
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
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -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: