Show More
@@ -46,6 +46,7 b' from .revlogutils.constants import (' | |||
|
46 | 46 | REVLOG_DEFAULT_FLAGS, |
|
47 | 47 | REVLOG_DEFAULT_FORMAT, |
|
48 | 48 | REVLOG_DEFAULT_VERSION, |
|
49 | SUPPORTED_FLAGS, | |
|
49 | 50 | ) |
|
50 | 51 | from .revlogutils.flagutil import ( |
|
51 | 52 | REVIDX_DEFAULT_FLAGS, |
@@ -487,33 +488,24 b' class revlog(object):' | |||
|
487 | 488 | self._format_flags = header & ~0xFFFF |
|
488 | 489 | self._format_version = header & 0xFFFF |
|
489 | 490 | |
|
490 | if self._format_version == REVLOGV0: | |
|
491 |
|
|
|
491 | supported_flags = SUPPORTED_FLAGS.get(self._format_version) | |
|
492 | if supported_flags is None: | |
|
493 | msg = _(b'unknown version (%d) in revlog %s') | |
|
494 | msg %= (self._format_version, self.display_id) | |
|
495 | raise error.RevlogError(msg) | |
|
496 | elif self._format_flags & ~supported_flags: | |
|
492 | 497 |
|
|
493 | 498 |
|
|
494 | 499 |
|
|
495 | 500 |
|
|
496 | 501 | |
|
502 | if self._format_version == REVLOGV0: | |
|
497 | 503 | self._inline = False |
|
498 | 504 | self._generaldelta = False |
|
499 | ||
|
500 | 505 | elif self._format_version == REVLOGV1: |
|
501 | if self._format_flags & ~REVLOGV1_FLAGS: | |
|
502 | msg = _(b'unknown flags (%#04x) in version %d revlog %s') | |
|
503 | display_flag = self._format_flags >> 16 | |
|
504 | msg %= (display_flag, self._format_version, self.display_id) | |
|
505 | raise error.RevlogError(msg) | |
|
506 | ||
|
507 | 506 | self._inline = self._format_flags & FLAG_INLINE_DATA |
|
508 | 507 | self._generaldelta = self._format_flags & FLAG_GENERALDELTA |
|
509 | ||
|
510 | 508 | elif self._format_version == REVLOGV2: |
|
511 | if self._format_flags & ~REVLOGV2_FLAGS: | |
|
512 | msg = _(b'unknown flags (%#04x) in version %d revlog %s') | |
|
513 | display_flag = self._format_flags >> 16 | |
|
514 | msg %= (display_flag, self._format_version, self.display_id) | |
|
515 | raise error.RevlogError(msg) | |
|
516 | ||
|
517 | 509 | # There is a bug in the transaction handling when going from an |
|
518 | 510 | # inline revlog to a separate index and data file. Turn it off until |
|
519 | 511 | # it's fixed, since v2 revlogs sometimes get rewritten on exchange. |
@@ -523,11 +515,8 b' class revlog(object):' | |||
|
523 | 515 | self._generaldelta = True |
|
524 | 516 | # revlog-v2 has built in sidedata support |
|
525 | 517 | self.hassidedata = True |
|
526 | ||
|
527 | 518 | else: |
|
528 | msg = _(b'unknown version (%d) in revlog %s') | |
|
529 | msg %= (self._format_version, self.display_id) | |
|
530 | raise error.RevlogError(msg) | |
|
519 | assert False, 'unreachable' | |
|
531 | 520 | |
|
532 | 521 | index_data = entry_data |
|
533 | 522 | self._indexfile = entry_point |
@@ -45,6 +45,7 b' FLAG_GENERALDELTA = 1 << 17' | |||
|
45 | 45 | REVLOG_DEFAULT_FLAGS = FLAG_INLINE_DATA |
|
46 | 46 | REVLOG_DEFAULT_FORMAT = REVLOGV1 |
|
47 | 47 | REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS |
|
48 | REVLOGV0_FLAGS = 0 | |
|
48 | 49 | REVLOGV1_FLAGS = FLAG_INLINE_DATA | FLAG_GENERALDELTA |
|
49 | 50 | REVLOGV2_FLAGS = FLAG_INLINE_DATA |
|
50 | 51 | |
@@ -113,4 +114,10 b' REVIDX_FLAGS_ORDER = [' | |||
|
113 | 114 | # bitmark for flags that could cause rawdata content change |
|
114 | 115 | REVIDX_RAWTEXT_CHANGING_FLAGS = REVIDX_ISCENSORED | REVIDX_EXTSTORED |
|
115 | 116 | |
|
117 | SUPPORTED_FLAGS = { | |
|
118 | REVLOGV0: REVLOGV0_FLAGS, | |
|
119 | REVLOGV1: REVLOGV1_FLAGS, | |
|
120 | REVLOGV2: REVLOGV2_FLAGS, | |
|
121 | } | |
|
122 | ||
|
116 | 123 | SPARSE_REVLOG_MAX_CHAIN_LENGTH = 1000 |
General Comments 0
You need to be logged in to leave comments.
Login now