Patchwork D10601: revlog: use "entry_point" phrasing for loading the revlog

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

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -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