comparison mercurial/help/internals/revlogs.txt @ 28590:b0b9f6b0a777

help: document sharing of revlog header with revision 0 The previous docs were incorrect about there being a discrete header on revlogs.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 19 Mar 2016 15:17:33 -0700
parents c18292a6ff54
children 1111e84de635
comparison
equal deleted inserted replaced
28589:c4c7be9f0554 28590:b0b9f6b0a777
29 29
30 File Format 30 File Format
31 ----------- 31 -----------
32 32
33 A revlog begins with a 32-bit big endian integer holding version info 33 A revlog begins with a 32-bit big endian integer holding version info
34 and feature flags. 34 and feature flags. This integer is shared with the first revision
35 entry.
35 36
36 This integer is logically divided into 2 16-bit shorts. The least 37 This integer is logically divided into 2 16-bit shorts. The least
37 significant half of the integer is the format/version short. The other 38 significant half of the integer is the format/version short. The other
38 short holds feature flags that dictate behavior of the revlog. 39 short holds feature flags that dictate behavior of the revlog.
39 40
68 00 02 00 01 69 00 02 00 01
69 RevlogNG + generaldelta 70 RevlogNG + generaldelta
70 00 03 00 01 71 00 03 00 01
71 RevlogNG + inline + generaldelta 72 RevlogNG + inline + generaldelta
72 73
73 Following the 32-bit header is *index* data. Inlined revision data is possibly 74 Following the 32-bit header is the remainder of the first index entry.
74 located between index entries. More on this layout is described below. 75 Following that are remaining *index* data. Inlined revision data is
76 possibly located between index entries. More on this layout is described
77 below.
75 78
76 RevlogNG Format 79 RevlogNG Format
77 --------------- 80 ---------------
78 81
79 RevlogNG (version 1) begins with an index describing the revisions in 82 RevlogNG (version 1) begins with an index describing the revisions in
81 or between index entries (as opposed to in a separate container). 84 or between index entries (as opposed to in a separate container).
82 85
83 Each index entry is 64 bytes. The byte layout of each entry is as 86 Each index entry is 64 bytes. The byte layout of each entry is as
84 follows, with byte 0 being the first byte (all data stored as big endian): 87 follows, with byte 0 being the first byte (all data stored as big endian):
85 88
89 0-3 (4 bytes) (rev 0 only)
90 Revlog header
86 0-5 (6 bytes) 91 0-5 (6 bytes)
87 Absolute offset of revision data from beginning of revlog. 92 Absolute offset of revision data from beginning of revlog.
88 6-7 (2 bytes) 93 6-7 (2 bytes)
89 Bit flags impacting revision behavior. 94 Bit flags impacting revision behavior.
90 8-11 (4 bytes) 95 8-11 (4 bytes)
118 123
119 If revision data is not inline, then raw revision data is stored in a 124 If revision data is not inline, then raw revision data is stored in a
120 separate byte container. The offsets from bytes 0-5 and the compressed 125 separate byte container. The offsets from bytes 0-5 and the compressed
121 length from bytes 8-11 define how to access this data. 126 length from bytes 8-11 define how to access this data.
122 127
128 The first 4 bytes of the revlog are shared between the revlog header
129 and the 6 byte absolute offset field from the first revlog entry.
130
123 Delta Chains 131 Delta Chains
124 ------------ 132 ------------
125 133
126 Revision data is encoded as a chain of *chunks*. Each chain begins with 134 Revision data is encoded as a chain of *chunks*. Each chain begins with
127 the compressed original full text for that revision. Each subsequent 135 the compressed original full text for that revision. Each subsequent