Patchwork D5564: revlog: use separate variables to track version flags

login
register
mail settings
Submitter phabricator
Date Jan. 13, 2019, 3:28 a.m.
Message ID <f7c8632b3c9c75760ccc513adaa3c16d@localhost.localdomain>
Download mbox | patch
Permalink /patch/37699/
State Not Applicable
Headers show

Comments

phabricator - Jan. 13, 2019, 3:28 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG3f807237dc94: revlog: use separate variables to track version flags (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5564?vs=13160&id=13196

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: yuja, mercurial-devel

Patch

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