Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 41205:3f807237dc94
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
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 09 Jan 2019 19:54:01 -0800 |
parents | e3cfe0702eac |
children | a89b20a49c13 |
comparison
equal
deleted
inserted
replaced
41204:e3cfe0702eac | 41205:3f807237dc94 |
---|---|
389 def _loadindex(self): | 389 def _loadindex(self): |
390 mmapindexthreshold = None | 390 mmapindexthreshold = None |
391 opts = getattr(self.opener, 'options', {}) or {} | 391 opts = getattr(self.opener, 'options', {}) or {} |
392 | 392 |
393 if 'revlogv2' in opts: | 393 if 'revlogv2' in opts: |
394 versionflags = REVLOGV2 | FLAG_INLINE_DATA | 394 newversionflags = REVLOGV2 | FLAG_INLINE_DATA |
395 elif 'revlogv1' in opts: | 395 elif 'revlogv1' in opts: |
396 versionflags = REVLOGV1 | FLAG_INLINE_DATA | 396 newversionflags = REVLOGV1 | FLAG_INLINE_DATA |
397 if 'generaldelta' in opts: | 397 if 'generaldelta' in opts: |
398 versionflags |= FLAG_GENERALDELTA | 398 newversionflags |= FLAG_GENERALDELTA |
399 else: | 399 else: |
400 versionflags = REVLOG_DEFAULT_VERSION | 400 newversionflags = REVLOG_DEFAULT_VERSION |
401 | 401 |
402 if 'chunkcachesize' in opts: | 402 if 'chunkcachesize' in opts: |
403 self._chunkcachesize = opts['chunkcachesize'] | 403 self._chunkcachesize = opts['chunkcachesize'] |
404 if 'maxchainlen' in opts: | 404 if 'maxchainlen' in opts: |
405 self._maxchainlen = opts['maxchainlen'] | 405 self._maxchainlen = opts['maxchainlen'] |
444 else: | 444 else: |
445 indexdata = f.read() | 445 indexdata = f.read() |
446 if len(indexdata) > 0: | 446 if len(indexdata) > 0: |
447 versionflags = versionformat_unpack(indexdata[:4])[0] | 447 versionflags = versionformat_unpack(indexdata[:4])[0] |
448 self._initempty = False | 448 self._initempty = False |
449 else: | |
450 versionflags = newversionflags | |
449 except IOError as inst: | 451 except IOError as inst: |
450 if inst.errno != errno.ENOENT: | 452 if inst.errno != errno.ENOENT: |
451 raise | 453 raise |
454 | |
455 versionflags = newversionflags | |
452 | 456 |
453 self.version = versionflags | 457 self.version = versionflags |
454 | 458 |
455 flags = versionflags & ~0xFFFF | 459 flags = versionflags & ~0xFFFF |
456 fmt = versionflags & 0xFFFF | 460 fmt = versionflags & 0xFFFF |