Mercurial > hg
comparison mercurial/cext/revlog.c @ 47259:07641bafa646
revlog: compress sidedata when doing "post-pull" sidedata update
All path writing sidedata are now using compression (when appropriate).
Differential Revision: https://phab.mercurial-scm.org/D10656
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 03 May 2021 23:40:05 +0200 |
parents | 2b69555e4875 |
children | 9d1a8829f959 |
comparison
equal
deleted
inserted
replaced
47258:c4dbb7636a12 | 47259:07641bafa646 |
---|---|
531 inside the transaction that creates the given revision. */ | 531 inside the transaction that creates the given revision. */ |
532 static PyObject *index_replace_sidedata_info(indexObject *self, PyObject *args) | 532 static PyObject *index_replace_sidedata_info(indexObject *self, PyObject *args) |
533 { | 533 { |
534 uint64_t offset_flags, sidedata_offset; | 534 uint64_t offset_flags, sidedata_offset; |
535 int rev; | 535 int rev; |
536 char comp_mode; | |
536 Py_ssize_t sidedata_comp_len; | 537 Py_ssize_t sidedata_comp_len; |
537 char *data; | 538 char *data; |
538 #if LONG_MAX == 0x7fffffffL | 539 #if LONG_MAX == 0x7fffffffL |
539 const char *const sidedata_format = PY23("nKiK", "nKiK"); | 540 const char *const sidedata_format = PY23("nKiKB", "nKiKB"); |
540 #else | 541 #else |
541 const char *const sidedata_format = PY23("nkik", "nkik"); | 542 const char *const sidedata_format = PY23("nkikB", "nkikB"); |
542 #endif | 543 #endif |
543 | 544 |
544 if (self->entry_size == v1_entry_size || self->inlined) { | 545 if (self->entry_size == v1_entry_size || self->inlined) { |
545 /* | 546 /* |
546 There is a bug in the transaction handling when going from an | 547 There is a bug in the transaction handling when going from an |
551 raise_revlog_error(); | 552 raise_revlog_error(); |
552 return NULL; | 553 return NULL; |
553 } | 554 } |
554 | 555 |
555 if (!PyArg_ParseTuple(args, sidedata_format, &rev, &sidedata_offset, | 556 if (!PyArg_ParseTuple(args, sidedata_format, &rev, &sidedata_offset, |
556 &sidedata_comp_len, &offset_flags)) | 557 &sidedata_comp_len, &offset_flags, &comp_mode)) |
557 return NULL; | 558 return NULL; |
558 | 559 |
559 if (rev < 0 || rev >= index_length(self)) { | 560 if (rev < 0 || rev >= index_length(self)) { |
560 PyErr_SetString(PyExc_IndexError, "revision outside index"); | 561 PyErr_SetString(PyExc_IndexError, "revision outside index"); |
561 return NULL; | 562 return NULL; |
571 */ | 572 */ |
572 data = self->added + self->entry_size * (rev - self->length); | 573 data = self->added + self->entry_size * (rev - self->length); |
573 putbe64(offset_flags, data); | 574 putbe64(offset_flags, data); |
574 putbe64(sidedata_offset, data + 64); | 575 putbe64(sidedata_offset, data + 64); |
575 putbe32(sidedata_comp_len, data + 72); | 576 putbe32(sidedata_comp_len, data + 72); |
577 data[76] = (data[76] & ~(3 << 2)) | ((comp_mode & 3) << 2); | |
576 | 578 |
577 Py_RETURN_NONE; | 579 Py_RETURN_NONE; |
578 } | 580 } |
579 | 581 |
580 static PyObject *index_stats(indexObject *self) | 582 static PyObject *index_stats(indexObject *self) |