# HG changeset patch # User Gregory Szorc # Date 2019-01-10 03:54:01 # Node ID 3f807237dc94925b7f92aeb6a822440856cc8b47 # Parent e3cfe0702eac7264ee136770fadeb4c91f6d0734 revlog: use separate variables to track version flags It wasn't obvious to me that "versionflags" is used both to define the default version+features value for new revlogs and to track the value read from a revlog. We rename the former use and add explicit assignment of "versionflags" later to differentiate between the two. Differential Revision: https://phab.mercurial-scm.org/D5564 diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -391,13 +391,13 @@ class revlog(object): 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 @@ class revlog(object): 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