##// END OF EJS Templates
delta-find: clarify that revisioninfo.p1/p2 constains nodeid...
marmoute -
r52222:398a105b default
parent child Browse files
Show More
@@ -1,82 +1,82 b''
1 # mercurial.revlogutils -- basic utilities for revlog
1 # mercurial.revlogutils -- basic utilities for revlog
2 #
2 #
3 # Copyright 2019 Pierre-Yves David <pierre-yves.david@octobus.net>
3 # Copyright 2019 Pierre-Yves David <pierre-yves.david@octobus.net>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8
8
9 from ..thirdparty import attr
9 from ..thirdparty import attr
10 from ..interfaces import repository
10 from ..interfaces import repository
11
11
12 # See mercurial.revlogutils.constants for doc
12 # See mercurial.revlogutils.constants for doc
13 COMP_MODE_INLINE = 2
13 COMP_MODE_INLINE = 2
14 RANK_UNKNOWN = -1
14 RANK_UNKNOWN = -1
15
15
16
16
17 def offset_type(offset, type):
17 def offset_type(offset, type):
18 if (type & ~repository.REVISION_FLAGS_KNOWN) != 0:
18 if (type & ~repository.REVISION_FLAGS_KNOWN) != 0:
19 raise ValueError(b'unknown revlog index flags: %d' % type)
19 raise ValueError(b'unknown revlog index flags: %d' % type)
20 return int(int(offset) << 16 | type)
20 return int(int(offset) << 16 | type)
21
21
22
22
23 def entry(
23 def entry(
24 data_offset,
24 data_offset,
25 data_compressed_length,
25 data_compressed_length,
26 data_delta_base,
26 data_delta_base,
27 link_rev,
27 link_rev,
28 parent_rev_1,
28 parent_rev_1,
29 parent_rev_2,
29 parent_rev_2,
30 node_id,
30 node_id,
31 flags=0,
31 flags=0,
32 data_uncompressed_length=-1,
32 data_uncompressed_length=-1,
33 data_compression_mode=COMP_MODE_INLINE,
33 data_compression_mode=COMP_MODE_INLINE,
34 sidedata_offset=0,
34 sidedata_offset=0,
35 sidedata_compressed_length=0,
35 sidedata_compressed_length=0,
36 sidedata_compression_mode=COMP_MODE_INLINE,
36 sidedata_compression_mode=COMP_MODE_INLINE,
37 rank=RANK_UNKNOWN,
37 rank=RANK_UNKNOWN,
38 ):
38 ):
39 """Build one entry from symbolic name
39 """Build one entry from symbolic name
40
40
41 This is useful to abstract the actual detail of how we build the entry
41 This is useful to abstract the actual detail of how we build the entry
42 tuple for caller who don't care about it.
42 tuple for caller who don't care about it.
43
43
44 This should always be called using keyword arguments. Some arguments have
44 This should always be called using keyword arguments. Some arguments have
45 default value, this match the value used by index version that does not store such data.
45 default value, this match the value used by index version that does not store such data.
46 """
46 """
47 return (
47 return (
48 offset_type(data_offset, flags),
48 offset_type(data_offset, flags),
49 data_compressed_length,
49 data_compressed_length,
50 data_uncompressed_length,
50 data_uncompressed_length,
51 data_delta_base,
51 data_delta_base,
52 link_rev,
52 link_rev,
53 parent_rev_1,
53 parent_rev_1,
54 parent_rev_2,
54 parent_rev_2,
55 node_id,
55 node_id,
56 sidedata_offset,
56 sidedata_offset,
57 sidedata_compressed_length,
57 sidedata_compressed_length,
58 data_compression_mode,
58 data_compression_mode,
59 sidedata_compression_mode,
59 sidedata_compression_mode,
60 rank,
60 rank,
61 )
61 )
62
62
63
63
64 @attr.s(slots=True, frozen=True)
64 @attr.s(slots=True, frozen=True)
65 class revisioninfo:
65 class revisioninfo:
66 """Information about a revision that allows building its fulltext
66 """Information about a revision that allows building its fulltext
67 node: expected hash of the revision
67 node: expected hash of the revision
68 p1, p2: parent revs of the revision
68 p1, p2: parent revs of the revision (as node)
69 btext: built text cache consisting of a one-element list
69 btext: built text cache consisting of a one-element list
70 cachedelta: (baserev, uncompressed_delta, usage_mode) or None
70 cachedelta: (baserev, uncompressed_delta, usage_mode) or None
71 flags: flags associated to the revision storage
71 flags: flags associated to the revision storage
72
72
73 One of btext[0] or cachedelta must be set.
73 One of btext[0] or cachedelta must be set.
74 """
74 """
75
75
76 node = attr.ib()
76 node = attr.ib()
77 p1 = attr.ib()
77 p1 = attr.ib()
78 p2 = attr.ib()
78 p2 = attr.ib()
79 btext = attr.ib()
79 btext = attr.ib()
80 textlen = attr.ib()
80 textlen = attr.ib()
81 cachedelta = attr.ib()
81 cachedelta = attr.ib()
82 flags = attr.ib()
82 flags = attr.ib()
General Comments 0
You need to be logged in to leave comments. Login now