changeset 47189:21ef5f75edf0

revlog: use "entry_point" phrasing for loading the revlog The main entry for the revlog will not necessary be the index, but a small "docket". So we change the variable names and we move the initialisation of the index_file and data_file after that first entry point have been read. Differential Revision: https://phab.mercurial-scm.org/D10601
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 03 May 2021 12:26:59 +0200
parents 58ef549ae55f
children 8b549ea4bebf
files mercurial/revlog.py
diffstat 1 files changed, 10 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Mon May 03 12:26:48 2021 +0200
+++ b/mercurial/revlog.py	Mon May 03 12:26:59 2021 +0200
@@ -469,21 +469,13 @@
         new_header, 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
+            entry_point = b'%s.i' % 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
+            entry_point = b'%s.i.%s' % (self.radix, self.postfix)
 
         indexdata = b''
         self._initempty = True
-        indexdata = self._get_data(self._indexfile, mmapindexthreshold)
+        indexdata = self._get_data(entry_point, mmapindexthreshold)
         if len(indexdata) > 0:
             header = INDEX_HEADER.unpack(indexdata[:4])[0]
             self._initempty = False
@@ -533,6 +525,13 @@
             msg %= (self._format_version, self.display_id)
             raise error.RevlogError(msg)
 
+        self._indexfile = entry_point
+
+        if self.postfix is None or self.postfix == b'a':
+            self._datafile = b'%s.d' % self.radix
+        else:
+            self._datafile = b'%s.d.%s' % (self.radix, self.postfix)
+
         self.nodeconstants = sha1nodeconstants
         self.nullid = self.nodeconstants.nullid