##// END OF EJS Templates
revlog: move entry documentation alongside new related constants...
marmoute -
r48185:7a0ec25d default
parent child Browse files
Show More
@@ -310,66 +310,8 b' class revlog(object):'
310 310 the current position in the file handle is valid, and log/warn/fail (by
311 311 raising).
312 312
313
314 Internal details
315 ----------------
316
317 A large part of the revlog logic deals with revisions' "index entries", tuple
318 objects that contains the same "items" whatever the revlog version.
319 Different versions will have different ways of storing these items (sometimes
320 not having them at all), but the tuple will always be the same. New fields
321 are usually added at the end to avoid breaking existing code that relies
322 on the existing order. The field are defined as follows:
323
324 [0] offset:
325 The byte index of the start of revision data chunk.
326 That value is shifted up by 16 bits. use "offset = field >> 16" to
327 retrieve it.
328
329 flags:
330 A flag field that carries special information or changes the behavior
331 of the revision. (see `REVIDX_*` constants for details)
332 The flag field only occupies the first 16 bits of this field,
333 use "flags = field & 0xFFFF" to retrieve the value.
334
335 [1] compressed length:
336 The size, in bytes, of the chunk on disk
337
338 [2] uncompressed length:
339 The size, in bytes, of the full revision once reconstructed.
340
341 [3] base rev:
342 Either the base of the revision delta chain (without general
343 delta), or the base of the delta (stored in the data chunk)
344 with general delta.
345
346 [4] link rev:
347 Changelog revision number of the changeset introducing this
348 revision.
349
350 [5] parent 1 rev:
351 Revision number of the first parent
352
353 [6] parent 2 rev:
354 Revision number of the second parent
355
356 [7] node id:
357 The node id of the current revision
358
359 [8] sidedata offset:
360 The byte index of the start of the revision's side-data chunk.
361
362 [9] sidedata chunk length:
363 The size, in bytes, of the revision's side-data chunk.
364
365 [10] data compression mode:
366 two bits that detail the way the data chunk is compressed on disk.
367 (see "COMP_MODE_*" constants for details). For revlog version 0 and
368 1 this will always be COMP_MODE_INLINE.
369
370 [11] side-data compression mode:
371 two bits that detail the way the sidedata chunk is compressed on disk.
372 (see "COMP_MODE_*" constants for details)
313 See mercurial/revlogutils/contants.py for details about the content of an
314 index entry.
373 315 """
374 316
375 317 _flagserrorclass = error.RevlogError
@@ -27,6 +27,81 b' ALL_KINDS = {'
27 27 KIND_OTHER,
28 28 }
29 29
30 ### Index entry key
31 #
32 #
33 # Internal details
34 # ----------------
35 #
36 # A large part of the revlog logic deals with revisions' "index entries", tuple
37 # objects that contains the same "items" whatever the revlog version.
38 # Different versions will have different ways of storing these items (sometimes
39 # not having them at all), but the tuple will always be the same. New fields
40 # are usually added at the end to avoid breaking existing code that relies
41 # on the existing order. The field are defined as follows:
42
43 # [0] offset:
44 # The byte index of the start of revision data chunk.
45 # That value is shifted up by 16 bits. use "offset = field >> 16" to
46 # retrieve it.
47 #
48 # flags:
49 # A flag field that carries special information or changes the behavior
50 # of the revision. (see `REVIDX_*` constants for details)
51 # The flag field only occupies the first 16 bits of this field,
52 # use "flags = field & 0xFFFF" to retrieve the value.
53 ENTRY_DATA_OFFSET = 0
54
55 # [1] compressed length:
56 # The size, in bytes, of the chunk on disk
57 ENTRY_DATA_COMPRESSED_LENGTH = 1
58
59 # [2] uncompressed length:
60 # The size, in bytes, of the full revision once reconstructed.
61 ENTRY_DATA_UNCOMPRESSED_LENGTH = 2
62
63 # [3] base rev:
64 # Either the base of the revision delta chain (without general
65 # delta), or the base of the delta (stored in the data chunk)
66 # with general delta.
67 ENTRY_DELTA_BASE = 3
68
69 # [4] link rev:
70 # Changelog revision number of the changeset introducing this
71 # revision.
72 ENTRY_LINK_REV = 4
73
74 # [5] parent 1 rev:
75 # Revision number of the first parent
76 ENTRY_PARENT_1 = 5
77
78 # [6] parent 2 rev:
79 # Revision number of the second parent
80 ENTRY_PARENT_2 = 6
81
82 # [7] node id:
83 # The node id of the current revision
84 ENTRY_NODE_ID = 7
85
86 # [8] sidedata offset:
87 # The byte index of the start of the revision's side-data chunk.
88 ENTRY_SIDEDATA_OFFSET = 8
89
90 # [9] sidedata chunk length:
91 # The size, in bytes, of the revision's side-data chunk.
92 ENTRY_SIDEDATA_COMPRESSED_LENGTH = 9
93
94 # [10] data compression mode:
95 # two bits that detail the way the data chunk is compressed on disk.
96 # (see "COMP_MODE_*" constants for details). For revlog version 0 and
97 # 1 this will always be COMP_MODE_INLINE.
98 ENTRY_DATA_COMPRESSION_MODE = 10
99
100 # [11] side-data compression mode:
101 # two bits that detail the way the sidedata chunk is compressed on disk.
102 # (see "COMP_MODE_*" constants for details)
103 ENTRY_SIDEDATA_COMPRESSION_MODE = 11
104
30 105 ### main revlog header
31 106
32 107 # We cannot rely on Struct.format is inconsistent for python <=3.6 versus above
General Comments 0
You need to be logged in to leave comments. Login now