comparison mercurial/revlogutils/constants.py @ 46856:34e1fa4b548a

revlog: move the details of revlog "v0" index inside revlog.utils.constants the revlog module is quite large and this kind of format information would handy for other module. So let us start to gather this information about the format in a more appropriate place. Differential Revision: https://phab.mercurial-scm.org/D10303
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 05 Apr 2021 12:20:52 +0200
parents aba724bf550e
children cc65cea90edb
comparison
equal deleted inserted replaced
46855:aba724bf550e 46856:34e1fa4b548a
6 # This software may be used and distributed according to the terms of the 6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version. 7 # GNU General Public License version 2 or any later version.
8 """Helper class to compute deltas stored inside revlogs""" 8 """Helper class to compute deltas stored inside revlogs"""
9 9
10 from __future__ import absolute_import 10 from __future__ import absolute_import
11
12 import struct
11 13
12 from ..interfaces import repository 14 from ..interfaces import repository
13 15
14 ### main revlog header 16 ### main revlog header
15 17
29 REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS 31 REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS
30 REVLOGV1_FLAGS = FLAG_INLINE_DATA | FLAG_GENERALDELTA 32 REVLOGV1_FLAGS = FLAG_INLINE_DATA | FLAG_GENERALDELTA
31 REVLOGV2_FLAGS = FLAG_INLINE_DATA 33 REVLOGV2_FLAGS = FLAG_INLINE_DATA
32 34
33 ### individual entry 35 ### individual entry
36
37 ## index v0:
38 # 4 bytes: offset
39 # 4 bytes: compressed length
40 # 4 bytes: base rev
41 # 4 bytes: link rev
42 # 20 bytes: parent 1 nodeid
43 # 20 bytes: parent 2 nodeid
44 # 20 bytes: nodeid
45 INDEX_ENTRY_V0 = struct.Struct(b">4l20s20s20s")
34 46
35 # revlog index flags 47 # revlog index flags
36 48
37 # For historical reasons, revlog's internal flags were exposed via the 49 # For historical reasons, revlog's internal flags were exposed via the
38 # wire protocol and are even exposed in parts of the storage APIs. 50 # wire protocol and are even exposed in parts of the storage APIs.