Show More
@@ -23,13 +23,17 b' import struct, zlib, errno' | |||||
23 | _decompress = zlib.decompress |
|
23 | _decompress = zlib.decompress | |
24 | _sha = util.sha1 |
|
24 | _sha = util.sha1 | |
25 |
|
25 | |||
26 | # revlog flags |
|
26 | # revlog header flags | |
27 | REVLOGV0 = 0 |
|
27 | REVLOGV0 = 0 | |
28 | REVLOGNG = 1 |
|
28 | REVLOGNG = 1 | |
29 | REVLOGNGINLINEDATA = (1 << 16) |
|
29 | REVLOGNGINLINEDATA = (1 << 16) | |
|
30 | REVLOGSHALLOW = (1 << 17) | |||
30 | REVLOG_DEFAULT_FLAGS = REVLOGNGINLINEDATA |
|
31 | REVLOG_DEFAULT_FLAGS = REVLOGNGINLINEDATA | |
31 | REVLOG_DEFAULT_FORMAT = REVLOGNG |
|
32 | REVLOG_DEFAULT_FORMAT = REVLOGNG | |
32 | REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS |
|
33 | REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS | |
|
34 | REVLOGNG_FLAGS = REVLOGNGINLINEDATA | REVLOGSHALLOW | |||
|
35 | ||||
|
36 | # revlog index flags | |||
33 | REVIDX_PUNCHED_FLAG = 2 |
|
37 | REVIDX_PUNCHED_FLAG = 2 | |
34 | REVIDX_KNOWN_FLAGS = REVIDX_PUNCHED_FLAG |
|
38 | REVIDX_KNOWN_FLAGS = REVIDX_PUNCHED_FLAG | |
35 |
|
39 | |||
@@ -422,7 +426,7 b' class revlog(object):' | |||||
422 | remove data, and can use some simple techniques to avoid the need |
|
426 | remove data, and can use some simple techniques to avoid the need | |
423 | for locking while reading. |
|
427 | for locking while reading. | |
424 | """ |
|
428 | """ | |
425 | def __init__(self, opener, indexfile): |
|
429 | def __init__(self, opener, indexfile, shallowroot=None): | |
426 | """ |
|
430 | """ | |
427 | create a revlog object |
|
431 | create a revlog object | |
428 |
|
432 | |||
@@ -436,12 +440,15 b' class revlog(object):' | |||||
436 | self._chunkcache = (0, '') |
|
440 | self._chunkcache = (0, '') | |
437 | self.nodemap = {nullid: nullrev} |
|
441 | self.nodemap = {nullid: nullrev} | |
438 | self.index = [] |
|
442 | self.index = [] | |
|
443 | self._shallowroot = shallowroot | |||
439 |
|
444 | |||
440 | v = REVLOG_DEFAULT_VERSION |
|
445 | v = REVLOG_DEFAULT_VERSION | |
441 | if hasattr(opener, 'options') and 'defversion' in opener.options: |
|
446 | if hasattr(opener, 'options') and 'defversion' in opener.options: | |
442 | v = opener.options['defversion'] |
|
447 | v = opener.options['defversion'] | |
443 | if v & REVLOGNG: |
|
448 | if v & REVLOGNG: | |
444 | v |= REVLOGNGINLINEDATA |
|
449 | v |= REVLOGNGINLINEDATA | |
|
450 | if shallowroot: | |||
|
451 | v |= REVLOGSHALLOW | |||
445 |
|
452 | |||
446 | i = '' |
|
453 | i = '' | |
447 | try: |
|
454 | try: | |
@@ -458,12 +465,13 b' class revlog(object):' | |||||
458 |
|
465 | |||
459 | self.version = v |
|
466 | self.version = v | |
460 | self._inline = v & REVLOGNGINLINEDATA |
|
467 | self._inline = v & REVLOGNGINLINEDATA | |
|
468 | self._shallow = v & REVLOGSHALLOW | |||
461 | flags = v & ~0xFFFF |
|
469 | flags = v & ~0xFFFF | |
462 | fmt = v & 0xFFFF |
|
470 | fmt = v & 0xFFFF | |
463 | if fmt == REVLOGV0 and flags: |
|
471 | if fmt == REVLOGV0 and flags: | |
464 | raise RevlogError(_("index %s unknown flags %#04x for format v0") |
|
472 | raise RevlogError(_("index %s unknown flags %#04x for format v0") | |
465 | % (self.indexfile, flags >> 16)) |
|
473 | % (self.indexfile, flags >> 16)) | |
466 |
elif fmt == REVLOGNG and flags & ~REVLOGNG |
|
474 | elif fmt == REVLOGNG and flags & ~REVLOGNG_FLAGS: | |
467 | raise RevlogError(_("index %s unknown flags %#04x for revlogng") |
|
475 | raise RevlogError(_("index %s unknown flags %#04x for revlogng") | |
468 | % (self.indexfile, flags >> 16)) |
|
476 | % (self.indexfile, flags >> 16)) | |
469 | elif fmt > REVLOGNG: |
|
477 | elif fmt > REVLOGNG: |
General Comments 0
You need to be logged in to leave comments.
Login now