mercurial/revlog.py
changeset 41205 3f807237dc94
parent 41204 e3cfe0702eac
child 41247 a89b20a49c13
--- a/mercurial/revlog.py	Wed Jan 09 16:18:00 2019 -0800
+++ b/mercurial/revlog.py	Wed Jan 09 19:54:01 2019 -0800
@@ -391,13 +391,13 @@
         opts = getattr(self.opener, 'options', {}) or {}
 
         if 'revlogv2' in opts:
-            versionflags = REVLOGV2 | FLAG_INLINE_DATA
+            newversionflags = REVLOGV2 | FLAG_INLINE_DATA
         elif 'revlogv1' in opts:
-            versionflags = REVLOGV1 | FLAG_INLINE_DATA
+            newversionflags = REVLOGV1 | FLAG_INLINE_DATA
             if 'generaldelta' in opts:
-                versionflags |= FLAG_GENERALDELTA
+                newversionflags |= FLAG_GENERALDELTA
         else:
-            versionflags = REVLOG_DEFAULT_VERSION
+            newversionflags = REVLOG_DEFAULT_VERSION
 
         if 'chunkcachesize' in opts:
             self._chunkcachesize = opts['chunkcachesize']
@@ -446,10 +446,14 @@
             if len(indexdata) > 0:
                 versionflags = versionformat_unpack(indexdata[:4])[0]
                 self._initempty = False
+            else:
+                versionflags = newversionflags
         except IOError as inst:
             if inst.errno != errno.ENOENT:
                 raise
 
+            versionflags = newversionflags
+
         self.version = versionflags
 
         flags = versionflags & ~0xFFFF