comparison mercurial/revlogutils/constants.py @ 48497:2c6084f67a86

changelog-v2: use helper constant in the code to pack/unpack entries This makes the code simpler to read and modify. This is probably less efficient, but we are talking about the Python implementation here, so performance is concerne secondary to readability. Differential Revision: https://phab.mercurial-scm.org/D11934
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 14 Dec 2021 19:24:24 +0100
parents a669404f0f4a
children d5137c00ab17
comparison
equal deleted inserted replaced
48496:30741bbea550 48497:2c6084f67a86
182 # 4 bytes: sidedata compressed length 182 # 4 bytes: sidedata compressed length
183 # 1 bytes: compression mode (2 lower bit are data_compression_mode) 183 # 1 bytes: compression mode (2 lower bit are data_compression_mode)
184 # 27 bytes: Padding to align to 96 bytes (see RevlogV2Plan wiki page) 184 # 27 bytes: Padding to align to 96 bytes (see RevlogV2Plan wiki page)
185 INDEX_ENTRY_CL_V2 = struct.Struct(b">Qiiii20s12xQiB27x") 185 INDEX_ENTRY_CL_V2 = struct.Struct(b">Qiiii20s12xQiB27x")
186 assert INDEX_ENTRY_CL_V2.size == 32 * 3, INDEX_ENTRY_V2.size 186 assert INDEX_ENTRY_CL_V2.size == 32 * 3, INDEX_ENTRY_V2.size
187 INDEX_ENTRY_V2_IDX_OFFSET = 0
188 INDEX_ENTRY_V2_IDX_COMPRESSED_LENGTH = 1
189 INDEX_ENTRY_V2_IDX_UNCOMPRESSED_LENGTH = 2
190 INDEX_ENTRY_V2_IDX_PARENT_1 = 3
191 INDEX_ENTRY_V2_IDX_PARENT_2 = 4
192 INDEX_ENTRY_V2_IDX_NODEID = 5
193 INDEX_ENTRY_V2_IDX_SIDEDATA_OFFSET = 6
194 INDEX_ENTRY_V2_IDX_SIDEDATA_COMPRESSED_LENGTH = 7
195 INDEX_ENTRY_V2_IDX_COMPRESSION_MODE = 8
187 196
188 # revlog index flags 197 # revlog index flags
189 198
190 # For historical reasons, revlog's internal flags were exposed via the 199 # For historical reasons, revlog's internal flags were exposed via the
191 # wire protocol and are even exposed in parts of the storage APIs. 200 # wire protocol and are even exposed in parts of the storage APIs.