comparison mercurial/revlog.py @ 11928:b69899dbad40

revlog: parentdelta flags for revlog index
author Pradeepkumar Gayam <in3xes@gmail.com>
date Tue, 10 Aug 2010 22:25:08 +0530
parents 05deba16c5d5
children 1839a7518b0d
comparison
equal deleted inserted replaced
11926:9b842c8fb4df 11928:b69899dbad40
32 REVLOG_DEFAULT_FORMAT = REVLOGNG 32 REVLOG_DEFAULT_FORMAT = REVLOGNG
33 REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS 33 REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS
34 REVLOGNG_FLAGS = REVLOGNGINLINEDATA | REVLOGSHALLOW 34 REVLOGNG_FLAGS = REVLOGNGINLINEDATA | REVLOGSHALLOW
35 35
36 # revlog index flags 36 # revlog index flags
37 REVIDX_PARENTDELTA = 1
37 REVIDX_PUNCHED_FLAG = 2 38 REVIDX_PUNCHED_FLAG = 2
38 REVIDX_KNOWN_FLAGS = REVIDX_PUNCHED_FLAG 39 REVIDX_KNOWN_FLAGS = REVIDX_PUNCHED_FLAG | REVIDX_PARENTDELTA
39 40
40 # amount of data read unconditionally, should be >= 4 41 # amount of data read unconditionally, should be >= 4
41 # when not inline: threshold for using lazy index 42 # when not inline: threshold for using lazy index
42 _prereadsize = 1048576 43 _prereadsize = 1048576
43 # max size of revlog with inline data 44 # max size of revlog with inline data
439 self._cache = None 440 self._cache = None
440 self._chunkcache = (0, '') 441 self._chunkcache = (0, '')
441 self.nodemap = {nullid: nullrev} 442 self.nodemap = {nullid: nullrev}
442 self.index = [] 443 self.index = []
443 self._shallowroot = shallowroot 444 self._shallowroot = shallowroot
445 self._parentdelta = 0
444 446
445 v = REVLOG_DEFAULT_VERSION 447 v = REVLOG_DEFAULT_VERSION
446 if hasattr(opener, 'options') and 'defversion' in opener.options: 448 if hasattr(opener, 'options') and 'defversion' in opener.options:
447 v = opener.options['defversion'] 449 v = opener.options['defversion']
448 if v & REVLOGNG: 450 if v & REVLOGNG:
449 v |= REVLOGNGINLINEDATA 451 v |= REVLOGNGINLINEDATA
452 if v & REVLOGNG and 'parentdelta' in opener.options:
453 self._parentdelta = 1
454
450 if shallowroot: 455 if shallowroot:
451 v |= REVLOGSHALLOW 456 v |= REVLOGSHALLOW
452 457
453 i = '' 458 i = ''
454 try: 459 try: