Show More
@@ -35,6 +35,7 from .i18n import _ | |||||
35 | from .pycompat import getattr |
|
35 | from .pycompat import getattr | |
36 | from .revlogutils.constants import ( |
|
36 | from .revlogutils.constants import ( | |
37 | ALL_KINDS, |
|
37 | ALL_KINDS, | |
|
38 | FEATURES_BY_VERSION, | |||
38 | FLAG_GENERALDELTA, |
|
39 | FLAG_GENERALDELTA, | |
39 | FLAG_INLINE_DATA, |
|
40 | FLAG_INLINE_DATA, | |
40 | INDEX_HEADER, |
|
41 | INDEX_HEADER, | |
@@ -499,24 +500,10 class revlog(object): | |||||
499 | msg %= (display_flag, self._format_version, self.display_id) |
|
500 | msg %= (display_flag, self._format_version, self.display_id) | |
500 | raise error.RevlogError(msg) |
|
501 | raise error.RevlogError(msg) | |
501 |
|
502 | |||
502 | if self._format_version == REVLOGV0: |
|
503 | features = FEATURES_BY_VERSION[self._format_version] | |
503 | self._inline = False |
|
504 | self._inline = features[b'inline'](self._format_flags) | |
504 | self._generaldelta = False |
|
505 | self._generaldelta = features[b'generaldelta'](self._format_flags) | |
505 | elif self._format_version == REVLOGV1: |
|
506 | self.hassidedata = features[b'sidedata'] | |
506 | self._inline = self._format_flags & FLAG_INLINE_DATA |
|
|||
507 | self._generaldelta = self._format_flags & FLAG_GENERALDELTA |
|
|||
508 | elif self._format_version == REVLOGV2: |
|
|||
509 | # There is a bug in the transaction handling when going from an |
|
|||
510 | # inline revlog to a separate index and data file. Turn it off until |
|
|||
511 | # it's fixed, since v2 revlogs sometimes get rewritten on exchange. |
|
|||
512 | # See issue6485 |
|
|||
513 | self._inline = False |
|
|||
514 | # generaldelta implied by version 2 revlogs. |
|
|||
515 | self._generaldelta = True |
|
|||
516 | # revlog-v2 has built in sidedata support |
|
|||
517 | self.hassidedata = True |
|
|||
518 | else: |
|
|||
519 | assert False, 'unreachable' |
|
|||
520 |
|
507 | |||
521 | index_data = entry_data |
|
508 | index_data = entry_data | |
522 | self._indexfile = entry_point |
|
509 | self._indexfile = entry_point |
@@ -120,4 +120,34 SUPPORTED_FLAGS = { | |||||
120 | REVLOGV2: REVLOGV2_FLAGS, |
|
120 | REVLOGV2: REVLOGV2_FLAGS, | |
121 | } |
|
121 | } | |
122 |
|
122 | |||
|
123 | _no = lambda flags: False | |||
|
124 | _yes = lambda flags: True | |||
|
125 | ||||
|
126 | ||||
|
127 | def _from_flag(flag): | |||
|
128 | return lambda flags: bool(flags & flag) | |||
|
129 | ||||
|
130 | ||||
|
131 | FEATURES_BY_VERSION = { | |||
|
132 | REVLOGV0: { | |||
|
133 | b'inline': _no, | |||
|
134 | b'generaldelta': _no, | |||
|
135 | b'sidedata': False, | |||
|
136 | }, | |||
|
137 | REVLOGV1: { | |||
|
138 | b'inline': _from_flag(FLAG_INLINE_DATA), | |||
|
139 | b'generaldelta': _from_flag(FLAG_GENERALDELTA), | |||
|
140 | b'sidedata': False, | |||
|
141 | }, | |||
|
142 | REVLOGV2: { | |||
|
143 | # There is a bug in the transaction handling when going from an | |||
|
144 | # inline revlog to a separate index and data file. Turn it off until | |||
|
145 | # it's fixed, since v2 revlogs sometimes get rewritten on exchange. | |||
|
146 | # See issue6485 | |||
|
147 | b'inline': _no, | |||
|
148 | b'generaldelta': _yes, | |||
|
149 | b'sidedata': True, | |||
|
150 | }, | |||
|
151 | } | |||
|
152 | ||||
123 | SPARSE_REVLOG_MAX_CHAIN_LENGTH = 1000 |
|
153 | SPARSE_REVLOG_MAX_CHAIN_LENGTH = 1000 |
General Comments 0
You need to be logged in to leave comments.
Login now