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 |