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