##// END OF EJS Templates
revlog: add a function to build index entry tuple...
marmoute -
r48187:a669404f default
parent child Browse files
Show More
@@ -9,8 +9,50 b' from __future__ import absolute_import'
9
9
10 from ..interfaces import repository
10 from ..interfaces import repository
11
11
12 # See mercurial.revlogutils.constants for doc
13 COMP_MODE_INLINE = 2
14
12
15
13 def offset_type(offset, type):
16 def offset_type(offset, type):
14 if (type & ~repository.REVISION_FLAGS_KNOWN) != 0:
17 if (type & ~repository.REVISION_FLAGS_KNOWN) != 0:
15 raise ValueError(b'unknown revlog index flags: %d' % type)
18 raise ValueError(b'unknown revlog index flags: %d' % type)
16 return int(int(offset) << 16 | type)
19 return int(int(offset) << 16 | type)
20
21
22 def entry(
23 data_offset,
24 data_compressed_length,
25 data_delta_base,
26 link_rev,
27 parent_rev_1,
28 parent_rev_2,
29 node_id,
30 flags=0,
31 data_uncompressed_length=-1,
32 data_compression_mode=COMP_MODE_INLINE,
33 sidedata_offset=0,
34 sidedata_compressed_length=0,
35 sidedata_compression_mode=COMP_MODE_INLINE,
36 ):
37 """Build one entry from symbolic name
38
39 This is useful to abstract the actual detail of how we build the entry
40 tuple for caller who don't care about it.
41
42 This should always be called using keyword arguments. Some arguments have
43 default value, this match the value used by index version that does not store such data.
44 """
45 return (
46 offset_type(data_offset, flags),
47 data_compressed_length,
48 data_uncompressed_length,
49 data_delta_base,
50 link_rev,
51 parent_rev_1,
52 parent_rev_2,
53 node_id,
54 sidedata_offset,
55 sidedata_compressed_length,
56 data_compression_mode,
57 sidedata_compression_mode,
58 )
@@ -12,6 +12,7 b' from __future__ import absolute_import'
12 import struct
12 import struct
13
13
14 from ..interfaces import repository
14 from ..interfaces import repository
15 from .. import revlogutils
15
16
16 ### Internal utily constants
17 ### Internal utily constants
17
18
@@ -229,7 +230,7 b' COMP_MODE_DEFAULT = 1'
229
230
230 # Chunk use a compression mode stored "inline" at the start of the chunk
231 # Chunk use a compression mode stored "inline" at the start of the chunk
231 # itself. This is the mode always used for revlog version "0" and "1"
232 # itself. This is the mode always used for revlog version "0" and "1"
232 COMP_MODE_INLINE = 2
233 COMP_MODE_INLINE = revlogutils.COMP_MODE_INLINE
233
234
234 SUPPORTED_FLAGS = {
235 SUPPORTED_FLAGS = {
235 REVLOGV0: REVLOGV0_FLAGS,
236 REVLOGV0: REVLOGV0_FLAGS,
General Comments 0
You need to be logged in to leave comments. Login now