Show More
@@ -1344,7 +1344,6 b' coreconfigitem(' | |||||
1344 | # Experimental TODOs: |
|
1344 | # Experimental TODOs: | |
1345 | # |
|
1345 | # | |
1346 | # * Same as for evlogv2 (but for the reduction of the number of files) |
|
1346 | # * Same as for evlogv2 (but for the reduction of the number of files) | |
1347 | # * drop the storage of the base |
|
|||
1348 | # * Improvement to investigate |
|
1347 | # * Improvement to investigate | |
1349 | # - storing .hgtags fnode |
|
1348 | # - storing .hgtags fnode | |
1350 | # - storing `rank` of changesets |
|
1349 | # - storing `rank` of changesets |
@@ -295,6 +295,10 b' def parse_index2(data, inline, revlogv2=' | |||||
295 | return cls(data, inline), (0, data) |
|
295 | return cls(data, inline), (0, data) | |
296 |
|
296 | |||
297 |
|
297 | |||
|
298 | def parse_index_cl_v2(data): | |||
|
299 | return IndexChangelogV2(data), None | |||
|
300 | ||||
|
301 | ||||
298 | class IndexObject2(IndexObject): |
|
302 | class IndexObject2(IndexObject): | |
299 | index_format = revlog_constants.INDEX_ENTRY_V2 |
|
303 | index_format = revlog_constants.INDEX_ENTRY_V2 | |
300 |
|
304 | |||
@@ -355,6 +359,26 b' class IndexObject2(IndexObject):' | |||||
355 | raise error.ProgrammingError(msg) |
|
359 | raise error.ProgrammingError(msg) | |
356 |
|
360 | |||
357 |
|
361 | |||
|
362 | class IndexChangelogV2(IndexObject2): | |||
|
363 | index_format = revlog_constants.INDEX_ENTRY_CL_V2 | |||
|
364 | ||||
|
365 | def _unpack_entry(self, rev, data, r=True): | |||
|
366 | items = self.index_format.unpack(data) | |||
|
367 | entry = items[:3] + (rev, rev) + items[3:8] | |||
|
368 | data_comp = items[8] & 3 | |||
|
369 | sidedata_comp = (items[8] >> 2) & 3 | |||
|
370 | return entry + (data_comp, sidedata_comp) | |||
|
371 | ||||
|
372 | def _pack_entry(self, rev, entry): | |||
|
373 | assert entry[3] == rev, entry[3] | |||
|
374 | assert entry[4] == rev, entry[4] | |||
|
375 | data = entry[:3] + entry[5:10] | |||
|
376 | data_comp = entry[10] & 3 | |||
|
377 | sidedata_comp = (entry[11] & 3) << 2 | |||
|
378 | data += (data_comp | sidedata_comp,) | |||
|
379 | return self.index_format.pack(*data) | |||
|
380 | ||||
|
381 | ||||
358 | def parse_index_devel_nodemap(data, inline): |
|
382 | def parse_index_devel_nodemap(data, inline): | |
359 | """like parse_index2, but alway return a PersistentNodeMapIndexObject""" |
|
383 | """like parse_index2, but alway return a PersistentNodeMapIndexObject""" | |
360 | return PersistentNodeMapIndexObject(data), None |
|
384 | return PersistentNodeMapIndexObject(data), None |
@@ -227,6 +227,15 b' def parse_index_v2(data, inline):' | |||||
227 | return index, cache |
|
227 | return index, cache | |
228 |
|
228 | |||
229 |
|
229 | |||
|
230 | def parse_index_cl_v2(data, inline): | |||
|
231 | # call the C implementation to parse the index data | |||
|
232 | assert not inline | |||
|
233 | from .pure.parsers import parse_index_cl_v2 | |||
|
234 | ||||
|
235 | index, cache = parse_index_cl_v2(data) | |||
|
236 | return index, cache | |||
|
237 | ||||
|
238 | ||||
230 | if util.safehasattr(parsers, 'parse_index_devel_nodemap'): |
|
239 | if util.safehasattr(parsers, 'parse_index_devel_nodemap'): | |
231 |
|
240 | |||
232 | def parse_index_v1_nodemap(data, inline): |
|
241 | def parse_index_v1_nodemap(data, inline): | |
@@ -652,7 +661,7 b' class revlog(object):' | |||||
652 | elif self._format_version == REVLOGV2: |
|
661 | elif self._format_version == REVLOGV2: | |
653 | self._parse_index = parse_index_v2 |
|
662 | self._parse_index = parse_index_v2 | |
654 | elif self._format_version == CHANGELOGV2: |
|
663 | elif self._format_version == CHANGELOGV2: | |
655 | self._parse_index = parse_index_v2 |
|
664 | self._parse_index = parse_index_cl_v2 | |
656 | elif devel_nodemap: |
|
665 | elif devel_nodemap: | |
657 | self._parse_index = parse_index_v1_nodemap |
|
666 | self._parse_index = parse_index_v1_nodemap | |
658 | elif use_rust_index: |
|
667 | elif use_rust_index: |
@@ -93,6 +93,20 b' assert INDEX_ENTRY_V1.size == 32 * 2' | |||||
93 | INDEX_ENTRY_V2 = struct.Struct(b">Qiiiiii20s12xQiB19x") |
|
93 | INDEX_ENTRY_V2 = struct.Struct(b">Qiiiiii20s12xQiB19x") | |
94 | assert INDEX_ENTRY_V2.size == 32 * 3, INDEX_ENTRY_V2.size |
|
94 | assert INDEX_ENTRY_V2.size == 32 * 3, INDEX_ENTRY_V2.size | |
95 |
|
95 | |||
|
96 | # 6 bytes: offset | |||
|
97 | # 2 bytes: flags | |||
|
98 | # 4 bytes: compressed length | |||
|
99 | # 4 bytes: uncompressed length | |||
|
100 | # 4 bytes: parent 1 rev | |||
|
101 | # 4 bytes: parent 2 rev | |||
|
102 | # 32 bytes: nodeid | |||
|
103 | # 8 bytes: sidedata offset | |||
|
104 | # 4 bytes: sidedata compressed length | |||
|
105 | # 1 bytes: compression mode (2 lower bit are data_compression_mode) | |||
|
106 | # 27 bytes: Padding to align to 96 bytes (see RevlogV2Plan wiki page) | |||
|
107 | INDEX_ENTRY_CL_V2 = struct.Struct(b">Qiiii20s12xQiB27x") | |||
|
108 | assert INDEX_ENTRY_CL_V2.size == 32 * 3, INDEX_ENTRY_V2.size | |||
|
109 | ||||
96 | # revlog index flags |
|
110 | # revlog index flags | |
97 |
|
111 | |||
98 | # For historical reasons, revlog's internal flags were exposed via the |
|
112 | # For historical reasons, revlog's internal flags were exposed via the |
General Comments 0
You need to be logged in to leave comments.
Login now