mercurial/revlog.py
changeset 41200 cecf3f8bccd3
parent 41115 536c83535cbd
child 41201 6439cefaeb64
equal deleted inserted replaced
41199:d8fe67db5234 41200:cecf3f8bccd3
   382 
   382 
   383         # 2-tuple of file handles being used for active writing.
   383         # 2-tuple of file handles being used for active writing.
   384         self._writinghandles = None
   384         self._writinghandles = None
   385 
   385 
   386         mmapindexthreshold = None
   386         mmapindexthreshold = None
   387         v = REVLOG_DEFAULT_VERSION
   387         opts = getattr(opener, 'options', {}) or {}
   388         opts = getattr(opener, 'options', None)
   388 
   389         if opts is not None:
   389         if 'revlogv2' in opts:
   390             if 'revlogv2' in opts:
   390             # version 2 revlogs always use generaldelta.
   391                 # version 2 revlogs always use generaldelta.
   391             v = REVLOGV2 | FLAG_GENERALDELTA | FLAG_INLINE_DATA
   392                 v = REVLOGV2 | FLAG_GENERALDELTA | FLAG_INLINE_DATA
   392         elif 'revlogv1' in opts:
   393             elif 'revlogv1' in opts:
   393             v = REVLOGV1 | FLAG_INLINE_DATA
   394                 if 'generaldelta' in opts:
   394             if 'generaldelta' in opts:
   395                     v |= FLAG_GENERALDELTA
   395                 v |= FLAG_GENERALDELTA
   396             else:
   396         else:
   397                 v = 0
   397             v = REVLOG_DEFAULT_VERSION
   398             if 'chunkcachesize' in opts:
   398 
   399                 self._chunkcachesize = opts['chunkcachesize']
   399         if 'chunkcachesize' in opts:
   400             if 'maxchainlen' in opts:
   400             self._chunkcachesize = opts['chunkcachesize']
   401                 self._maxchainlen = opts['maxchainlen']
   401         if 'maxchainlen' in opts:
   402             if 'deltabothparents' in opts:
   402             self._maxchainlen = opts['maxchainlen']
   403                 self._deltabothparents = opts['deltabothparents']
   403         if 'deltabothparents' in opts:
   404             self._lazydeltabase = bool(opts.get('lazydeltabase', False))
   404             self._deltabothparents = opts['deltabothparents']
   405             if 'compengine' in opts:
   405         self._lazydeltabase = bool(opts.get('lazydeltabase', False))
   406                 self._compengine = opts['compengine']
   406         if 'compengine' in opts:
   407             if 'maxdeltachainspan' in opts:
   407             self._compengine = opts['compengine']
   408                 self._maxdeltachainspan = opts['maxdeltachainspan']
   408         if 'maxdeltachainspan' in opts:
   409             if mmaplargeindex and 'mmapindexthreshold' in opts:
   409             self._maxdeltachainspan = opts['maxdeltachainspan']
   410                 mmapindexthreshold = opts['mmapindexthreshold']
   410         if mmaplargeindex and 'mmapindexthreshold' in opts:
   411             self._sparserevlog = bool(opts.get('sparse-revlog', False))
   411             mmapindexthreshold = opts['mmapindexthreshold']
   412             withsparseread = bool(opts.get('with-sparse-read', False))
   412         self._sparserevlog = bool(opts.get('sparse-revlog', False))
   413             # sparse-revlog forces sparse-read
   413         withsparseread = bool(opts.get('with-sparse-read', False))
   414             self._withsparseread = self._sparserevlog or withsparseread
   414         # sparse-revlog forces sparse-read
   415             if 'sparse-read-density-threshold' in opts:
   415         self._withsparseread = self._sparserevlog or withsparseread
   416                 self._srdensitythreshold = opts['sparse-read-density-threshold']
   416         if 'sparse-read-density-threshold' in opts:
   417             if 'sparse-read-min-gap-size' in opts:
   417             self._srdensitythreshold = opts['sparse-read-density-threshold']
   418                 self._srmingapsize = opts['sparse-read-min-gap-size']
   418         if 'sparse-read-min-gap-size' in opts:
   419             if opts.get('enableellipsis'):
   419             self._srmingapsize = opts['sparse-read-min-gap-size']
   420                 self._flagprocessors[REVIDX_ELLIPSIS] = ellipsisprocessor
   420         if opts.get('enableellipsis'):
   421 
   421             self._flagprocessors[REVIDX_ELLIPSIS] = ellipsisprocessor
   422             # revlog v0 doesn't have flag processors
   422 
   423             for flag, processor in opts.get(b'flagprocessors', {}).iteritems():
   423         # revlog v0 doesn't have flag processors
   424                 _insertflagprocessor(flag, processor, self._flagprocessors)
   424         for flag, processor in opts.get(b'flagprocessors', {}).iteritems():
       
   425             _insertflagprocessor(flag, processor, self._flagprocessors)
   425 
   426 
   426         if self._chunkcachesize <= 0:
   427         if self._chunkcachesize <= 0:
   427             raise error.RevlogError(_('revlog chunk cache size %r is not '
   428             raise error.RevlogError(_('revlog chunk cache size %r is not '
   428                                       'greater than 0') % self._chunkcachesize)
   429                                       'greater than 0') % self._chunkcachesize)
   429         elif self._chunkcachesize & (self._chunkcachesize - 1):
   430         elif self._chunkcachesize & (self._chunkcachesize - 1):