Show More
@@ -338,12 +338,13 b' static PyObject *index_get(indexObject *' | |||||
338 | if (self->format_version == format_v1) { |
|
338 | if (self->format_version == format_v1) { | |
339 | sidedata_offset = 0; |
|
339 | sidedata_offset = 0; | |
340 | sidedata_comp_len = 0; |
|
340 | sidedata_comp_len = 0; | |
|
341 | data_comp_mode = comp_mode_inline; | |||
341 | } else { |
|
342 | } else { | |
342 | sidedata_offset = getbe64(data + 64); |
|
343 | sidedata_offset = getbe64(data + 64); | |
343 | sidedata_comp_len = getbe32(data + 72); |
|
344 | sidedata_comp_len = getbe32(data + 72); | |
|
345 | data_comp_mode = data[76]; | |||
344 | } |
|
346 | } | |
345 |
|
347 | |||
346 | data_comp_mode = comp_mode_inline; |
|
|||
347 | return Py_BuildValue(tuple_format, offset_flags, comp_len, uncomp_len, |
|
348 | return Py_BuildValue(tuple_format, offset_flags, comp_len, uncomp_len, | |
348 | base_rev, link_rev, parent_1, parent_2, c_node_id, |
|
349 | base_rev, link_rev, parent_1, parent_2, c_node_id, | |
349 | self->nodelen, sidedata_offset, sidedata_comp_len, |
|
350 | self->nodelen, sidedata_offset, sidedata_comp_len, | |
@@ -466,7 +467,8 b' static PyObject *index_append(indexObjec' | |||||
466 | PyErr_SetString(PyExc_TypeError, "invalid node"); |
|
467 | PyErr_SetString(PyExc_TypeError, "invalid node"); | |
467 | return NULL; |
|
468 | return NULL; | |
468 | } |
|
469 | } | |
469 | if (data_comp_mode != comp_mode_inline) { |
|
470 | if (self->format_version == format_v1 && | |
|
471 | data_comp_mode != comp_mode_inline) { | |||
470 | PyErr_Format(PyExc_ValueError, |
|
472 | PyErr_Format(PyExc_ValueError, | |
471 | "invalid data compression mode: %i", |
|
473 | "invalid data compression mode: %i", | |
472 | data_comp_mode); |
|
474 | data_comp_mode); | |
@@ -499,8 +501,9 b' static PyObject *index_append(indexObjec' | |||||
499 | if (self->format_version == format_v2) { |
|
501 | if (self->format_version == format_v2) { | |
500 | putbe64(sidedata_offset, data + 64); |
|
502 | putbe64(sidedata_offset, data + 64); | |
501 | putbe32(sidedata_comp_len, data + 72); |
|
503 | putbe32(sidedata_comp_len, data + 72); | |
|
504 | data[76] = (char)data_comp_mode; | |||
502 | /* Padding for 96 bytes alignment */ |
|
505 | /* Padding for 96 bytes alignment */ | |
503 |
memset(data + 7 |
|
506 | memset(data + 77, 0, self->entry_size - 77); | |
504 | } |
|
507 | } | |
505 |
|
508 | |||
506 | if (self->ntinitialized) |
|
509 | if (self->ntinitialized) |
@@ -315,12 +315,10 b' class Index2Mixin(object):' | |||||
315 | self._extra[rev - self._lgt] = new |
|
315 | self._extra[rev - self._lgt] = new | |
316 |
|
316 | |||
317 | def _unpack_entry(self, data): |
|
317 | def _unpack_entry(self, data): | |
318 |
return self.index_format.unpack(data) |
|
318 | return self.index_format.unpack(data) | |
319 | revlog_constants.COMP_MODE_INLINE, |
|
|||
320 | ) |
|
|||
321 |
|
319 | |||
322 | def _pack_entry(self, entry): |
|
320 | def _pack_entry(self, entry): | |
323 |
return self.index_format.pack(*entry[:1 |
|
321 | return self.index_format.pack(*entry[:11]) | |
324 |
|
322 | |||
325 | def entry_binary(self, rev): |
|
323 | def entry_binary(self, rev): | |
326 | """return the raw binary string representing a revision""" |
|
324 | """return the raw binary string representing a revision""" |
@@ -85,9 +85,10 b' assert INDEX_ENTRY_V1.size == 32 * 2' | |||||
85 | # 32 bytes: nodeid |
|
85 | # 32 bytes: nodeid | |
86 | # 8 bytes: sidedata offset |
|
86 | # 8 bytes: sidedata offset | |
87 | # 4 bytes: sidedata compressed length |
|
87 | # 4 bytes: sidedata compressed length | |
88 | # 20 bytes: Padding to align to 96 bytes (see RevlogV2Plan wiki page) |
|
88 | # 1 bytes: compression mode (2 lower bit are data_compression_mode) | |
89 | INDEX_ENTRY_V2 = struct.Struct(b">Qiiiiii20s12xQi20x") |
|
89 | # 19 bytes: Padding to align to 96 bytes (see RevlogV2Plan wiki page) | |
90 | assert INDEX_ENTRY_V2.size == 32 * 3 |
|
90 | INDEX_ENTRY_V2 = struct.Struct(b">Qiiiiii20s12xQiB19x") | |
|
91 | assert INDEX_ENTRY_V2.size == 32 * 3, INDEX_ENTRY_V2.size | |||
91 |
|
92 | |||
92 | # revlog index flags |
|
93 | # revlog index flags | |
93 |
|
94 |
General Comments 0
You need to be logged in to leave comments.
Login now