Mercurial > hg
annotate mercurial/helptext/internals/revlogs.txt @ 46005:2c0ddb79a8cd
helptext: update first hg version when share-safe will be released
I authored the patch which added the helptext before 5.6 release hoping that my
patches will make it. However they didn't before the release and were pushed
after the release only.
Differential Revision: https://phab.mercurial-scm.org/D9410
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 27 Nov 2020 18:11:04 +0530 |
parents | 9a6b409b8ebc |
children |
rev | line source |
---|---|
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 Revision logs - or *revlogs* - are an append only data structure for |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
2 storing discrete entries, or *revisions*. They are the primary storage |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
3 mechanism of repository data. |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
4 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
5 Revlogs effectively model a directed acyclic graph (DAG). Each node |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
6 has edges to 1 or 2 *parent* nodes. Each node contains metadata and |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
7 the raw value for that node. |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
8 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
9 Revlogs consist of entries which have metadata and revision data. |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
10 Metadata includes the hash of the revision's content, sizes, and |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
11 links to its *parent* entries. The collective metadata is referred |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
12 to as the *index* and the revision data is the *data*. |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
13 |
41199
d8fe67db5234
internals: minor rewriting of revlogs documentation
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32697
diff
changeset
|
14 Revision data is stored as a series of compressed deltas against |
d8fe67db5234
internals: minor rewriting of revlogs documentation
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32697
diff
changeset
|
15 ancestor revisions. |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
16 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
17 Revlogs are written in an append-only fashion. We never need to rewrite |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
18 a file to insert nor do we need to remove data. Rolling back in-progress |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
19 writes can be performed by truncating files. Read locks can be avoided |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
20 using simple techniques. This means that references to other data in |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
21 the same revlog *always* refer to a previous entry. |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
22 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
23 Revlogs can be modeled as 0-indexed arrays. The first revision is |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
24 revision #0 and the second is revision #1. The revision -1 is typically |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
25 used to mean *does not exist* or *not defined*. |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
26 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
27 File Format |
29747
aba2bb2a6d0f
help: don't try to render a section on sub-topics
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29094
diff
changeset
|
28 =========== |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
29 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
30 A revlog begins with a 32-bit big endian integer holding version info |
42401
bfd65b5e070b
help: clarify overlap of revlog header and first revlog entry
Nathan Goldbaum <nathan12343@gmail.com>
parents:
41202
diff
changeset
|
31 and feature flags. This integer overlaps with the first four bytes of |
bfd65b5e070b
help: clarify overlap of revlog header and first revlog entry
Nathan Goldbaum <nathan12343@gmail.com>
parents:
41202
diff
changeset
|
32 the first revision entry. |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
33 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
34 This integer is logically divided into 2 16-bit shorts. The least |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
35 significant half of the integer is the format/version short. The other |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
36 short holds feature flags that dictate behavior of the revlog. |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
37 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
38 The following values for the format/version short are defined: |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
39 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
40 0 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
41 The original revlog version. |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
42 1 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
43 RevlogNG (*next generation*). It replaced version 0 when it was |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
44 implemented in 2006. |
32697
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32393
diff
changeset
|
45 2 |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32393
diff
changeset
|
46 In-development version incorporating accumulated knowledge and |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32393
diff
changeset
|
47 missing features from 10+ years of revlog version 1. |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32393
diff
changeset
|
48 57005 (0xdead) |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32393
diff
changeset
|
49 Reserved for internal testing of new versions. No defined format |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32393
diff
changeset
|
50 beyond 32-bit header. |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
51 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
52 The feature flags short consists of bit flags. Where 0 is the least |
41199
d8fe67db5234
internals: minor rewriting of revlogs documentation
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32697
diff
changeset
|
53 significant bit. The bit flags vary by revlog version. |
d8fe67db5234
internals: minor rewriting of revlogs documentation
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32697
diff
changeset
|
54 |
d8fe67db5234
internals: minor rewriting of revlogs documentation
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32697
diff
changeset
|
55 Version 0 revlogs have no defined flags and the presence of a flag |
d8fe67db5234
internals: minor rewriting of revlogs documentation
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32697
diff
changeset
|
56 is considered an error. |
d8fe67db5234
internals: minor rewriting of revlogs documentation
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32697
diff
changeset
|
57 |
d8fe67db5234
internals: minor rewriting of revlogs documentation
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32697
diff
changeset
|
58 Version 1 revlogs have the following flags at the specified bit offsets: |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
59 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
60 0 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
61 Store revision data inline. |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
62 1 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
63 Generaldelta encoding. |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
64 |
41199
d8fe67db5234
internals: minor rewriting of revlogs documentation
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32697
diff
changeset
|
65 Version 2 revlogs have the following flags at the specified bit offsets: |
d8fe67db5234
internals: minor rewriting of revlogs documentation
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32697
diff
changeset
|
66 |
d8fe67db5234
internals: minor rewriting of revlogs documentation
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32697
diff
changeset
|
67 0 |
d8fe67db5234
internals: minor rewriting of revlogs documentation
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32697
diff
changeset
|
68 Store revision data inline. |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
69 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
70 The following header values are common: |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
71 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
72 00 00 00 01 |
32393
d47b62368f3a
revlog: remove some revlogNG terminology
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31214
diff
changeset
|
73 v1 |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
74 00 01 00 01 |
32393
d47b62368f3a
revlog: remove some revlogNG terminology
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31214
diff
changeset
|
75 v1 + inline |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
76 00 02 00 01 |
32393
d47b62368f3a
revlog: remove some revlogNG terminology
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31214
diff
changeset
|
77 v1 + generaldelta |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
78 00 03 00 01 |
32393
d47b62368f3a
revlog: remove some revlogNG terminology
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31214
diff
changeset
|
79 v1 + inline + generaldelta |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
80 |
42401
bfd65b5e070b
help: clarify overlap of revlog header and first revlog entry
Nathan Goldbaum <nathan12343@gmail.com>
parents:
41202
diff
changeset
|
81 Following the 32-bit header is the remaining 60 bytes of the first index |
bfd65b5e070b
help: clarify overlap of revlog header and first revlog entry
Nathan Goldbaum <nathan12343@gmail.com>
parents:
41202
diff
changeset
|
82 entry. Following that are additional *index* entries. Inlined revision |
42403
4ce7cdd78da3
help: remove a superfluous "the" in revlogs text
Martin von Zweigbergk <martinvonz@google.com>
parents:
42401
diff
changeset
|
83 data is possibly located between index entries. More on this inlined |
42401
bfd65b5e070b
help: clarify overlap of revlog header and first revlog entry
Nathan Goldbaum <nathan12343@gmail.com>
parents:
41202
diff
changeset
|
84 layout is described below. |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
85 |
32393
d47b62368f3a
revlog: remove some revlogNG terminology
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31214
diff
changeset
|
86 Version 1 Format |
d47b62368f3a
revlog: remove some revlogNG terminology
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31214
diff
changeset
|
87 ================ |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
88 |
32393
d47b62368f3a
revlog: remove some revlogNG terminology
Gregory Szorc <gregory.szorc@gmail.com>
parents:
31214
diff
changeset
|
89 Version 1 (RevlogNG) begins with an index describing the revisions in |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
90 the revlog. If the ``inline`` flag is set, revision data is stored inline, |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
91 or between index entries (as opposed to in a separate container). |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
92 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
93 Each index entry is 64 bytes. The byte layout of each entry is as |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
94 follows, with byte 0 being the first byte (all data stored as big endian): |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
95 |
28590
b0b9f6b0a777
help: document sharing of revlog header with revision 0
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27631
diff
changeset
|
96 0-3 (4 bytes) (rev 0 only) |
b0b9f6b0a777
help: document sharing of revlog header with revision 0
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27631
diff
changeset
|
97 Revlog header |
30827
e997e4826459
help: format revlog.txt more closely to result
Martin von Zweigbergk <martinvonz@google.com>
parents:
30746
diff
changeset
|
98 |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
99 0-5 (6 bytes) |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
100 Absolute offset of revision data from beginning of revlog. |
30827
e997e4826459
help: format revlog.txt more closely to result
Martin von Zweigbergk <martinvonz@google.com>
parents:
30746
diff
changeset
|
101 |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
102 6-7 (2 bytes) |
30523
726d30a6d89b
censor: flag internal documentation
Remi Chaintron <remi@fb.com>
parents:
30499
diff
changeset
|
103 Bit flags impacting revision behavior. The following bit offsets define: |
30828
0b792507ea15
help: don't let tools reflow revlog flags list
Martin von Zweigbergk <martinvonz@google.com>
parents:
30827
diff
changeset
|
104 |
30658
c49be208ae34
documentation: better censor flag documentation
Remi Chaintron <remi@fb.com>
parents:
30523
diff
changeset
|
105 0: REVIDX_ISCENSORED revision has censor metadata, must be verified. |
30828
0b792507ea15
help: don't let tools reflow revlog flags list
Martin von Zweigbergk <martinvonz@google.com>
parents:
30827
diff
changeset
|
106 |
30829
08b34c3a6f74
revlog: give EXTSTORED flag value to narrowhg
Martin von Zweigbergk <martinvonz@google.com>
parents:
30828
diff
changeset
|
107 1: REVIDX_ELLIPSIS revision hash does not match its data. Used by |
08b34c3a6f74
revlog: give EXTSTORED flag value to narrowhg
Martin von Zweigbergk <martinvonz@google.com>
parents:
30828
diff
changeset
|
108 narrowhg |
08b34c3a6f74
revlog: give EXTSTORED flag value to narrowhg
Martin von Zweigbergk <martinvonz@google.com>
parents:
30828
diff
changeset
|
109 |
08b34c3a6f74
revlog: give EXTSTORED flag value to narrowhg
Martin von Zweigbergk <martinvonz@google.com>
parents:
30828
diff
changeset
|
110 2: REVIDX_EXTSTORED revision data is stored externally. |
30827
e997e4826459
help: format revlog.txt more closely to result
Martin von Zweigbergk <martinvonz@google.com>
parents:
30746
diff
changeset
|
111 |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
112 8-11 (4 bytes) |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
113 Compressed length of revision data / chunk as stored in revlog. |
30827
e997e4826459
help: format revlog.txt more closely to result
Martin von Zweigbergk <martinvonz@google.com>
parents:
30746
diff
changeset
|
114 |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
115 12-15 (4 bytes) |
30499
22d05b53b0e8
help: clarify contents of revlog index
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29747
diff
changeset
|
116 Uncompressed length of revision data. This is the size of the full |
22d05b53b0e8
help: clarify contents of revlog index
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29747
diff
changeset
|
117 revision data, not the size of the chunk post decompression. |
30827
e997e4826459
help: format revlog.txt more closely to result
Martin von Zweigbergk <martinvonz@google.com>
parents:
30746
diff
changeset
|
118 |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
119 16-19 (4 bytes) |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
120 Base or previous revision this revision's delta was produced against. |
31214
167b69ccc62c
help: align description of 'base rev' with reality [issue5488]
Kim Alvefur <zash@zash.se>
parents:
30829
diff
changeset
|
121 This revision holds full text (as opposed to a delta) if it points to |
167b69ccc62c
help: align description of 'base rev' with reality [issue5488]
Kim Alvefur <zash@zash.se>
parents:
30829
diff
changeset
|
122 itself. For generaldelta repos, this is the previous revision in the |
167b69ccc62c
help: align description of 'base rev' with reality [issue5488]
Kim Alvefur <zash@zash.se>
parents:
30829
diff
changeset
|
123 delta chain. For non-generaldelta repos, this is the base or first |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
124 revision in the delta chain. |
30827
e997e4826459
help: format revlog.txt more closely to result
Martin von Zweigbergk <martinvonz@google.com>
parents:
30746
diff
changeset
|
125 |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
126 20-23 (4 bytes) |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
127 A revision this revision is *linked* to. This allows a revision in |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
128 one revlog to be forever associated with a revision in another |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
129 revlog. For example, a file's revlog may point to the changelog |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
130 revision that introduced it. |
30827
e997e4826459
help: format revlog.txt more closely to result
Martin von Zweigbergk <martinvonz@google.com>
parents:
30746
diff
changeset
|
131 |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
132 24-27 (4 bytes) |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
133 Revision of 1st parent. -1 indicates no parent. |
30827
e997e4826459
help: format revlog.txt more closely to result
Martin von Zweigbergk <martinvonz@google.com>
parents:
30746
diff
changeset
|
134 |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
135 28-31 (4 bytes) |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
136 Revision of 2nd parent. -1 indicates no 2nd parent. |
30827
e997e4826459
help: format revlog.txt more closely to result
Martin von Zweigbergk <martinvonz@google.com>
parents:
30746
diff
changeset
|
137 |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
138 32-63 (32 bytes) |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
139 Hash of revision's full text. Currently, SHA-1 is used and only |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
140 the first 20 bytes of this field are used. The rest of the bytes |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
141 are ignored and should be stored as \0. |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
142 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
143 If inline revision data is being stored, the compressed revision data |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
144 (of length from bytes offset 8-11 from the index entry) immediately |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
145 follows the index entry. There is no header on the revision data. There |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
146 is no padding between it and the index entries before and after. |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
147 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
148 If revision data is not inline, then raw revision data is stored in a |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
149 separate byte container. The offsets from bytes 0-5 and the compressed |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
150 length from bytes 8-11 define how to access this data. |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
151 |
42401
bfd65b5e070b
help: clarify overlap of revlog header and first revlog entry
Nathan Goldbaum <nathan12343@gmail.com>
parents:
41202
diff
changeset
|
152 The 6 byte absolute offset field from the first revlog entry overlaps |
bfd65b5e070b
help: clarify overlap of revlog header and first revlog entry
Nathan Goldbaum <nathan12343@gmail.com>
parents:
41202
diff
changeset
|
153 with the revlog header. That is, the first 6 bytes of the first revlog |
bfd65b5e070b
help: clarify overlap of revlog header and first revlog entry
Nathan Goldbaum <nathan12343@gmail.com>
parents:
41202
diff
changeset
|
154 entry can be split into four bytes containing the header for the revlog |
bfd65b5e070b
help: clarify overlap of revlog header and first revlog entry
Nathan Goldbaum <nathan12343@gmail.com>
parents:
41202
diff
changeset
|
155 file and an additional two bytes containing the offset for the first |
bfd65b5e070b
help: clarify overlap of revlog header and first revlog entry
Nathan Goldbaum <nathan12343@gmail.com>
parents:
41202
diff
changeset
|
156 entry. Since this is the offset from the beginning of the file for the |
bfd65b5e070b
help: clarify overlap of revlog header and first revlog entry
Nathan Goldbaum <nathan12343@gmail.com>
parents:
41202
diff
changeset
|
157 first revision entry, the two bytes will always be set to zero. |
28590
b0b9f6b0a777
help: document sharing of revlog header with revision 0
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27631
diff
changeset
|
158 |
32697
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32393
diff
changeset
|
159 Version 2 Format |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32393
diff
changeset
|
160 ================ |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32393
diff
changeset
|
161 |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32393
diff
changeset
|
162 (In development. Format not finalized or stable.) |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32393
diff
changeset
|
163 |
44862
5fe8f02ced6d
help: fix description of revlog version 2
Aay Jay Chan <aayjaychan@itopia.com.hk>
parents:
43632
diff
changeset
|
164 Version 2 is identical to version 1 with the following differences. |
41202
e7a2cc84dbc0
revlog: always enable generaldelta on version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41199
diff
changeset
|
165 |
e7a2cc84dbc0
revlog: always enable generaldelta on version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41199
diff
changeset
|
166 There is no dedicated *generaldelta* revlog format flag. Instead, |
e7a2cc84dbc0
revlog: always enable generaldelta on version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41199
diff
changeset
|
167 the feature is implied enabled by default. |
32697
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32393
diff
changeset
|
168 |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
169 Delta Chains |
29747
aba2bb2a6d0f
help: don't try to render a section on sub-topics
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29094
diff
changeset
|
170 ============ |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
171 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
172 Revision data is encoded as a chain of *chunks*. Each chain begins with |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
173 the compressed original full text for that revision. Each subsequent |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
174 *chunk* is a *delta* against the previous revision. We therefore call |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
175 these chains of chunks/deltas *delta chains*. |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
176 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
177 The full text for a revision is reconstructed by loading the original |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
178 full text for the base revision of a *delta chain* and then applying |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
179 *deltas* until the target revision is reconstructed. |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
180 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
181 *Delta chains* are limited in length so lookup time is bound. They are |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
182 limited to ~2x the length of the revision's data. The linear distance |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
183 between the base chunk and the final chunk is also limited so the |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
184 amount of read I/O to load all chunks in the delta chain is bound. |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
185 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
186 Deltas and delta chains are either computed against the previous |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
187 revision in the revlog or another revision (almost certainly one of |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
188 the parents of the revision). Historically, deltas were computed against |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
189 the previous revision. The *generaldelta* revlog feature flag (enabled |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
190 by default in Mercurial 3.7) activates the mode where deltas are |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
191 computed against an arbitrary revision (almost certainly a parent revision). |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
192 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
193 File Storage |
29747
aba2bb2a6d0f
help: don't try to render a section on sub-topics
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29094
diff
changeset
|
194 ============ |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
195 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
196 Revlogs logically consist of an index (metadata of entries) and |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
197 revision data. This data may be stored together in a single file or in |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
198 separate files. The mechanism used is indicated by the ``inline`` feature |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
199 flag on the revlog. |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
200 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
201 Mercurial's behavior is to use inline storage until a revlog reaches a |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
202 certain size, at which point it will be converted to non-inline. The |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
203 reason there is a size limit on inline storage is to establish an upper |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
204 bound on how much data must be read to load the index. It would be a waste |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
205 to read tens or hundreds of extra megabytes of data just to access the |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
206 index data. |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
207 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
208 The actual layout of revlog files on disk is governed by the repository's |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
209 *store format*. Typically, a ``.i`` file represents the index revlog |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
210 (possibly containing inline data) and a ``.d`` file holds the revision data. |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
211 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
212 Revision Entries |
29747
aba2bb2a6d0f
help: don't try to render a section on sub-topics
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29094
diff
changeset
|
213 ================ |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
214 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
215 Revision entries consist of an optional 1 byte header followed by an |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
216 encoding of the revision data. The headers are as follows: |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
217 |
45402
684083d104f9
documentation: add `zstd` compression to the internal `revlogs` documentation
Antoine Cezar <antoine.cezar@octobus.net>
parents:
44862
diff
changeset
|
218 \0 (0x00) |
684083d104f9
documentation: add `zstd` compression to the internal `revlogs` documentation
Antoine Cezar <antoine.cezar@octobus.net>
parents:
44862
diff
changeset
|
219 Revision data is the entirety of the entry, including this header. |
684083d104f9
documentation: add `zstd` compression to the internal `revlogs` documentation
Antoine Cezar <antoine.cezar@octobus.net>
parents:
44862
diff
changeset
|
220 ( (0x28) |
684083d104f9
documentation: add `zstd` compression to the internal `revlogs` documentation
Antoine Cezar <antoine.cezar@octobus.net>
parents:
44862
diff
changeset
|
221 zstd https://github.com/facebook/zstd |
684083d104f9
documentation: add `zstd` compression to the internal `revlogs` documentation
Antoine Cezar <antoine.cezar@octobus.net>
parents:
44862
diff
changeset
|
222 u (0x75) |
684083d104f9
documentation: add `zstd` compression to the internal `revlogs` documentation
Antoine Cezar <antoine.cezar@octobus.net>
parents:
44862
diff
changeset
|
223 Raw revision data follows. |
684083d104f9
documentation: add `zstd` compression to the internal `revlogs` documentation
Antoine Cezar <antoine.cezar@octobus.net>
parents:
44862
diff
changeset
|
224 x (0x78) |
684083d104f9
documentation: add `zstd` compression to the internal `revlogs` documentation
Antoine Cezar <antoine.cezar@octobus.net>
parents:
44862
diff
changeset
|
225 zlib (RFC 1950) data. |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
226 |
45402
684083d104f9
documentation: add `zstd` compression to the internal `revlogs` documentation
Antoine Cezar <antoine.cezar@octobus.net>
parents:
44862
diff
changeset
|
227 The 0x78 value is actually the first byte of the zlib header (CMF byte). |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
228 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
229 Hash Computation |
29747
aba2bb2a6d0f
help: don't try to render a section on sub-topics
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29094
diff
changeset
|
230 ================ |
27631
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
231 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
232 The hash of the revision is stored in the index and is used both as a primary |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
233 key and for data integrity verification. |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
234 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
235 Currently, SHA-1 is the only supported hashing algorithm. To obtain the SHA-1 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
236 hash of a revision: |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
237 |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
238 1. Hash the parent nodes |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
239 2. Hash the fulltext of the revision |
c18292a6ff54
internals: document revlog format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
240 |
28590
b0b9f6b0a777
help: document sharing of revlog header with revision 0
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27631
diff
changeset
|
241 The 20 byte node ids of the parents are fed into the hasher in ascending order. |
45634
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
242 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
243 Changed Files side-data |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
244 ======================= |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
245 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
246 (This feature is in active development and its behavior is not frozen yet. It |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
247 should not be used in any production repository) |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
248 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
249 When the `exp-copies-sidedata-changeset` requirement is in use, information |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
250 related to the changed files will be stored as "side-data" for every changeset |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
251 in the changelog. |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
252 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
253 These data contains the following information: |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
254 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
255 * set of files actively added by the changeset |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
256 * set of files actively removed by the changeset |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
257 * set of files actively merged by the changeset |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
258 * set of files actively touched by he changeset |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
259 * mapping of copy-source, copy-destination from first parent (p1) |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
260 * mapping of copy-source, copy-destination from second parent (p2) |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
261 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
262 The block itself is big-endian data, formatted in three sections: header, index, |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
263 and data. See below for details: |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
264 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
265 Header: |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
266 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
267 4 bytes: unsigned integer |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
268 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
269 total number of entry in the index |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
270 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
271 Index: |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
272 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
273 The index contains an entry for every involved filename. It is sorted by |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
274 filename. The entry use the following format: |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
275 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
276 1 byte: bits field |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
277 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
278 This byte hold two different bit fields: |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
279 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
280 The 2 lower bits carry copy information: |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
281 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
282 `00`: file has not copy information, |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
283 `10`: file is copied from a p1 source, |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
284 `11`: file is copied from a p2 source. |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
285 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
286 The 3 next bits carry action information. |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
287 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
288 `000`: file was untouched, it exist in the index as copy source, |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
289 `001`: file was actively added |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
290 `010`: file was actively merged |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
291 `011`: file was actively removed |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
292 `100`: reserved for future use |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
293 `101`: file was actively touched in any other way |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
294 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
295 (The last 2 bites are unused) |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
296 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
297 4 bytes: unsigned integer |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
298 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
299 Address (in bytes) of the end of the associated filename in the data |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
300 block. (This is the address of the first byte not part of the filename) |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
301 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
302 The start of the filename can be retrieve by reading that field for the |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
303 previous index entry. The filename of the first entry starts at zero. |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
304 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
305 4 bytes: unsigned integer |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
306 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
307 Index (in this very index) of the source of the copy (when a copy is |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
308 happening). If no copy is happening the value of this field is |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
309 irrelevant and could have any value. It is set to zero by convention |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
310 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
311 Data: |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
312 |
9a6b409b8ebc
changing-files: rework the way we store changed files in side-data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45402
diff
changeset
|
313 raw bytes block containing all filename concatenated without any separator. |