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