changeset 40056:0a4625ffd6c0

revlog: move loading of index data into own method This will allow us to "reload" a revlog instance from a rewritten index file, which will be used in a subsequent commit. Differential Revision: https://phab.mercurial-scm.org/D4868
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 02 Oct 2018 17:28:54 -0700
parents 801ccd8e67c0
children 324b4b10351e
files mercurial/revlog.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Wed Oct 03 10:57:35 2018 -0700
+++ b/mercurial/revlog.py	Tue Oct 02 17:28:54 2018 -0700
@@ -415,12 +415,15 @@
             raise error.RevlogError(_('revlog chunk cache size %r is not a '
                                       'power of 2') % self._chunkcachesize)
 
+        self._loadindex(v, mmapindexthreshold)
+
+    def _loadindex(self, v, mmapindexthreshold):
         indexdata = ''
         self._initempty = True
         try:
             with self._indexfp() as f:
                 if (mmapindexthreshold is not None and
-                        self.opener.fstat(f).st_size >= mmapindexthreshold):
+                    self.opener.fstat(f).st_size >= mmapindexthreshold):
                     indexdata = util.buffer(util.mmapread(f))
                 else:
                     indexdata = f.read()