Show More
@@ -354,6 +354,13 b' static PyObject *index_pack_header(index' | |||
|
354 | 354 | if (!PyArg_ParseTuple(args, "I", &header)) { |
|
355 | 355 | return NULL; |
|
356 | 356 | } |
|
357 | if (self->format_version != format_v1) { | |
|
358 | PyErr_Format(PyExc_RuntimeError, | |
|
359 | "version header should go in the docket, not the " | |
|
360 | "index: %lu", | |
|
361 | header); | |
|
362 | return NULL; | |
|
363 | } | |
|
357 | 364 | putbe32(header, out); |
|
358 | 365 | return PyBytes_FromStringAndSize(out, 4); |
|
359 | 366 | } |
@@ -378,7 +385,7 b' static PyObject *index_entry_binary(inde' | |||
|
378 | 385 | data = index_deref(self, rev); |
|
379 | 386 | if (data == NULL) |
|
380 | 387 | return NULL; |
|
381 | if (rev == 0) { | |
|
388 | if (rev == 0 && self->format_version == format_v1) { | |
|
382 | 389 | /* the header is eating the start of the first entry */ |
|
383 | 390 | return PyBytes_FromStringAndSize(data + 4, |
|
384 | 391 | self->entry_size - 4); |
@@ -1150,7 +1150,6 b' coreconfigitem(' | |||
|
1150 | 1150 | ) |
|
1151 | 1151 | # "out of experimental" todo list. |
|
1152 | 1152 | # |
|
1153 | # * stop storing version information in the index (it is already in the docket) | |
|
1154 | 1153 | # * properly hide uncommitted content to other process |
|
1155 | 1154 | # * expose transaction content hooks during pre-commit validation |
|
1156 | 1155 | # * include management of a persistent nodemap in the main docket |
@@ -15,6 +15,7 b' from ..node import (' | |||
|
15 | 15 | sha1nodeconstants, |
|
16 | 16 | ) |
|
17 | 17 | from .. import ( |
|
18 | error, | |
|
18 | 19 | pycompat, |
|
19 | 20 | util, |
|
20 | 21 | ) |
@@ -311,10 +312,14 b' class Index2Mixin(object):' | |||
|
311 | 312 | """return the raw binary string representing a revision""" |
|
312 | 313 | entry = self[rev] |
|
313 | 314 | p = revlog_constants.INDEX_ENTRY_V2.pack(*entry) |
|
314 | if rev == 0: | |
|
315 | p = p[revlog_constants.INDEX_HEADER.size :] | |
|
316 | 315 | return p |
|
317 | 316 | |
|
317 | def pack_header(self, header): | |
|
318 | """pack header information as binary""" | |
|
319 | msg = 'version header should go in the docket, not the index: %d' | |
|
320 | msg %= header | |
|
321 | raise error.ProgrammingError(msg) | |
|
322 | ||
|
318 | 323 | |
|
319 | 324 | class IndexObject2(Index2Mixin, IndexObject): |
|
320 | 325 | pass |
@@ -2017,7 +2017,7 b' class revlog(object):' | |||
|
2017 | 2017 | self._inline = False |
|
2018 | 2018 | for i in self: |
|
2019 | 2019 | e = self.index.entry_binary(i) |
|
2020 | if i == 0: | |
|
2020 | if i == 0 and self._docket is None: | |
|
2021 | 2021 | header = self._format_flags | self._format_version |
|
2022 | 2022 | header = self.index.pack_header(header) |
|
2023 | 2023 | e = header + e |
@@ -2380,7 +2380,7 b' class revlog(object):' | |||
|
2380 | 2380 | |
|
2381 | 2381 | self.index.append(e) |
|
2382 | 2382 | entry = self.index.entry_binary(curr) |
|
2383 | if curr == 0: | |
|
2383 | if curr == 0 and self._docket is None: | |
|
2384 | 2384 | header = self._format_flags | self._format_version |
|
2385 | 2385 | header = self.index.pack_header(header) |
|
2386 | 2386 | entry = header + entry |
@@ -3207,7 +3207,7 b' class revlog(object):' | |||
|
3207 | 3207 | rev = startrev + i |
|
3208 | 3208 | self.index.replace_sidedata_info(rev, e[8], e[9], e[0]) |
|
3209 | 3209 | packed = self.index.entry_binary(rev) |
|
3210 | if rev == 0: | |
|
3210 | if rev == 0 and self._docket is None: | |
|
3211 | 3211 | header = self._format_flags | self._format_version |
|
3212 | 3212 | header = self.index.pack_header(header) |
|
3213 | 3213 | packed = header + packed |
General Comments 0
You need to be logged in to leave comments.
Login now