diff 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
line wrap: on
line diff
--- a/mercurial/cext/revlog.c	Mon May 03 23:14:48 2021 +0200
+++ b/mercurial/cext/revlog.c	Mon May 03 23:40:05 2021 +0200
@@ -533,12 +533,13 @@
 {
 	uint64_t offset_flags, sidedata_offset;
 	int rev;
+	char comp_mode;
 	Py_ssize_t sidedata_comp_len;
 	char *data;
 #if LONG_MAX == 0x7fffffffL
-	const char *const sidedata_format = PY23("nKiK", "nKiK");
+	const char *const sidedata_format = PY23("nKiKB", "nKiKB");
 #else
-	const char *const sidedata_format = PY23("nkik", "nkik");
+	const char *const sidedata_format = PY23("nkikB", "nkikB");
 #endif
 
 	if (self->entry_size == v1_entry_size || self->inlined) {
@@ -553,7 +554,7 @@
 	}
 
 	if (!PyArg_ParseTuple(args, sidedata_format, &rev, &sidedata_offset,
-	                      &sidedata_comp_len, &offset_flags))
+	                      &sidedata_comp_len, &offset_flags, &comp_mode))
 		return NULL;
 
 	if (rev < 0 || rev >= index_length(self)) {
@@ -573,6 +574,7 @@
 	putbe64(offset_flags, data);
 	putbe64(sidedata_offset, data + 64);
 	putbe32(sidedata_comp_len, data + 72);
+	data[76] = (data[76] & ~(3 << 2)) | ((comp_mode & 3) << 2);
 
 	Py_RETURN_NONE;
 }