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