author | Arseniy Alekseyev <aalekseyev@janestreet.com> |
Thu, 01 Jun 2023 17:39:22 +0100 | |
changeset 50706 | 0452af304808 |
parent 47077 | 119790e1c67c |
permissions | -rw-r--r-- |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 |
Changegroups are representations of repository revlog data, specifically |
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
2 |
the changelog data, root/flat manifest data, treemanifest data, and |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
3 |
filelogs. |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
4 |
|
47077
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
5 |
There are 4 versions of changegroups: ``1``, ``2``, ``3`` and ``4``. From a |
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
6 |
high-level, versions ``1`` and ``2`` are almost exactly the same, with the |
40047
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
7 |
only difference being an additional item in the *delta header*. Version |
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
8 |
``3`` adds support for storage flags in the *delta header* and optionally |
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
9 |
exchanging treemanifests (enabled by setting an option on the |
47077
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
10 |
``changegroup`` part in the bundle2). Version ``4`` adds support for exchanging |
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
11 |
sidedata (additional revision metadata not part of the digest). |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
12 |
|
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
13 |
Changegroups when not exchanging treemanifests consist of 3 logical |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
14 |
segments:: |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
15 |
|
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
16 |
+---------------------------------+ |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
17 |
| | | | |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
18 |
| changeset | manifest | filelogs | |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
19 |
| | | | |
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
20 |
| | | | |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
21 |
+---------------------------------+ |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
22 |
|
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
23 |
When exchanging treemanifests, there are 4 logical segments:: |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
24 |
|
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
25 |
+-------------------------------------------------+ |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
26 |
| | | | | |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
27 |
| changeset | root | treemanifests | filelogs | |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
28 |
| | manifest | | | |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
29 |
| | | | | |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
30 |
+-------------------------------------------------+ |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
31 |
|
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
32 |
The principle building block of each segment is a *chunk*. A *chunk* |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
33 |
is a framed piece of data:: |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
34 |
|
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
35 |
+---------------------------------------+ |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
36 |
| | | |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
37 |
| length | data | |
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
38 |
| (4 bytes) | (<length - 4> bytes) | |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
39 |
| | | |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
40 |
+---------------------------------------+ |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
41 |
|
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
42 |
All integers are big-endian signed integers. Each chunk starts with a 32-bit |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
43 |
integer indicating the length of the entire chunk (including the length field |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
44 |
itself). |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
45 |
|
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
46 |
There is a special case chunk that has a value of 0 for the length |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
47 |
(``0x00000000``). We call this an *empty chunk*. |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
48 |
|
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
49 |
Delta Groups |
29747
aba2bb2a6d0f
help: don't try to render a section on sub-topics
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27434
diff
changeset
|
50 |
============ |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
51 |
|
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
52 |
A *delta group* expresses the content of a revlog as a series of deltas, |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
53 |
or patches against previous revisions. |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
54 |
|
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
55 |
Delta groups consist of 0 or more *chunks* followed by the *empty chunk* |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
56 |
to signal the end of the delta group:: |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
57 |
|
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
58 |
+------------------------------------------------------------------------+ |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
59 |
| | | | | | |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
60 |
| chunk0 length | chunk0 data | chunk1 length | chunk1 data | 0x0 | |
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
61 |
| (4 bytes) | (various) | (4 bytes) | (various) | (4 bytes) | |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
62 |
| | | | | | |
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
63 |
+------------------------------------------------------------------------+ |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
64 |
|
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
65 |
Each *chunk*'s data consists of the following:: |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
66 |
|
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
67 |
+---------------------------------------+ |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
68 |
| | | |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
69 |
| delta header | delta data | |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
70 |
| (various by version) | (various) | |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
71 |
| | | |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
72 |
+---------------------------------------+ |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
73 |
|
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
74 |
The *delta data* is a series of *delta*s that describe a diff from an existing |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
75 |
entry (either that the recipient already has, or previously specified in the |
32139
de86a6872d06
help: spelling fixes
Matt Harbison <matt_harbison@yahoo.com>
parents:
31287
diff
changeset
|
76 |
bundle/changegroup). |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
77 |
|
47077
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
78 |
The *delta header* is different between versions ``1``, ``2``, ``3`` and ``4`` |
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
79 |
of the changegroup format. |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
80 |
|
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
81 |
Version 1 (headerlen=80):: |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
82 |
|
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
83 |
+------------------------------------------------------+ |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
84 |
| | | | | |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
85 |
| node | p1 node | p2 node | link node | |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
86 |
| (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
87 |
| | | | | |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
88 |
+------------------------------------------------------+ |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
89 |
|
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
90 |
Version 2 (headerlen=100):: |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
91 |
|
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
92 |
+------------------------------------------------------------------+ |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
93 |
| | | | | | |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
94 |
| node | p1 node | p2 node | base node | link node | |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
95 |
| (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
96 |
| | | | | | |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
97 |
+------------------------------------------------------------------+ |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
98 |
|
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
99 |
Version 3 (headerlen=102):: |
27434
11150176a000
changegroups: add documentation for cg3
Augie Fackler <augie@google.com>
parents:
27372
diff
changeset
|
100 |
|
11150176a000
changegroups: add documentation for cg3
Augie Fackler <augie@google.com>
parents:
27372
diff
changeset
|
101 |
+------------------------------------------------------------------------------+ |
11150176a000
changegroups: add documentation for cg3
Augie Fackler <augie@google.com>
parents:
27372
diff
changeset
|
102 |
| | | | | | | |
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
103 |
| node | p1 node | p2 node | base node | link node | flags | |
27434
11150176a000
changegroups: add documentation for cg3
Augie Fackler <augie@google.com>
parents:
27372
diff
changeset
|
104 |
| (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) | |
11150176a000
changegroups: add documentation for cg3
Augie Fackler <augie@google.com>
parents:
27372
diff
changeset
|
105 |
| | | | | | | |
11150176a000
changegroups: add documentation for cg3
Augie Fackler <augie@google.com>
parents:
27372
diff
changeset
|
106 |
+------------------------------------------------------------------------------+ |
11150176a000
changegroups: add documentation for cg3
Augie Fackler <augie@google.com>
parents:
27372
diff
changeset
|
107 |
|
47077
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
108 |
Version 4 (headerlen=103):: |
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
109 |
|
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
110 |
+------------------------------------------------------------------------------+----------+ |
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
111 |
| | | | | | | | |
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
112 |
| node | p1 node | p2 node | base node | link node | flags | pflags | |
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
113 |
| (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (20 bytes) | (2 bytes) | (1 byte) | |
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
114 |
| | | | | | | | |
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
115 |
+------------------------------------------------------------------------------+----------+ |
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
116 |
|
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
117 |
The *delta data* consists of ``chunklen - 4 - headerlen`` bytes, which contain a |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
118 |
series of *delta*s, densely packed (no separators). These deltas describe a diff |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
119 |
from an existing entry (either that the recipient already has, or previously |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
120 |
specified in the bundle/changegroup). The format is described more fully in |
31287
16539e32ebe0
help: fix layout of pre-formatted text
Yuya Nishihara <yuya@tcha.org>
parents:
31213
diff
changeset
|
121 |
``hg help internals.bdiff``, but briefly:: |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
122 |
|
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
123 |
+---------------------------------------------------------------+ |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
124 |
| | | | | |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
125 |
| start offset | end offset | new length | content | |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
126 |
| (4 bytes) | (4 bytes) | (4 bytes) | (<new length> bytes) | |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
127 |
| | | | | |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
128 |
+---------------------------------------------------------------+ |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
129 |
|
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
130 |
Please note that the length field in the delta data does *not* include itself. |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
131 |
|
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
132 |
In version 1, the delta is always applied against the previous node from |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
133 |
the changegroup or the first parent if this is the first entry in the |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
134 |
changegroup. |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
135 |
|
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
136 |
In version 2 and up, the delta base node is encoded in the entry in the |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
137 |
changegroup. This allows the delta to be expressed against any parent, |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
138 |
which can result in smaller deltas and more efficient encoding of data. |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
139 |
|
40047
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
140 |
The *flags* field holds bitwise flags affecting the processing of revision |
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
141 |
data. The following flags are defined: |
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
142 |
|
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
143 |
32768 |
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
144 |
Censored revision. The revision's fulltext has been replaced by censor |
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
145 |
metadata. May only occur on file revisions. |
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
146 |
16384 |
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
147 |
Ellipsis revision. Revision hash does not match data (likely due to rewritten |
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
148 |
parents). |
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
149 |
8192 |
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
150 |
Externally stored. The revision fulltext contains ``key:value`` ``\n`` |
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
151 |
delimited metadata defining an object stored elsewhere. Used by the LFS |
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
152 |
extension. |
47077
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
153 |
4096 |
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
154 |
Contains copy information. This revision changes files in a way that could |
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
155 |
affect copy tracing. This does *not* affect changegroup handling, but is |
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
156 |
relevant for other parts of Mercurial. |
40047
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
157 |
|
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
158 |
For historical reasons, the integer values are identical to revlog version 1 |
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
159 |
per-revision storage flags and correspond to bits being set in this 2-byte |
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
160 |
field. Bits were allocated starting from the most-significant bit, hence the |
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
161 |
reverse ordering and allocation of these flags. |
8e398628a3f2
repository: define and use revision flag constants
Gregory Szorc <gregory.szorc@gmail.com>
parents:
32139
diff
changeset
|
162 |
|
47077
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
163 |
The *pflags* (protocol flags) field holds bitwise flags affecting the protocol |
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
164 |
itself. They are first in the header since they may affect the handling of the |
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
165 |
rest of the fields in a future version. They are defined as such: |
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
166 |
|
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
167 |
1 indicates whether to read a chunk of sidedata (of variable length) right |
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
168 |
after the revision flags. |
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
169 |
|
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
170 |
|
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
171 |
Changeset Segment |
29747
aba2bb2a6d0f
help: don't try to render a section on sub-topics
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27434
diff
changeset
|
172 |
================= |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
173 |
|
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
174 |
The *changeset segment* consists of a single *delta group* holding |
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
175 |
changelog data. The *empty chunk* at the end of the *delta group* denotes |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
176 |
the boundary to the *manifest segment*. |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
177 |
|
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
178 |
Manifest Segment |
29747
aba2bb2a6d0f
help: don't try to render a section on sub-topics
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27434
diff
changeset
|
179 |
================ |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
180 |
|
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
181 |
The *manifest segment* consists of a single *delta group* holding manifest |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
182 |
data. If treemanifests are in use, it contains only the manifest for the |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
183 |
root directory of the repository. Otherwise, it contains the entire |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
184 |
manifest data. The *empty chunk* at the end of the *delta group* denotes |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
185 |
the boundary to the next segment (either the *treemanifests segment* or the |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
186 |
*filelogs segment*, depending on version and the request options). |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
187 |
|
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
188 |
Treemanifests Segment |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
189 |
--------------------- |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
190 |
|
47077
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
191 |
The *treemanifests segment* only exists in changegroup version ``3`` and ``4``, |
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
192 |
and only if the 'treemanifest' param is part of the bundle2 changegroup part |
119790e1c67c
cg4: introduce protocol flag to signify the presence of sidedata
Raphaël Gomès <rgomes@octobus.net>
parents:
43632
diff
changeset
|
193 |
(it is not possible to use changegroup version 3 or 4 outside of bundle2). |
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
194 |
Aside from the filenames in the *treemanifests segment* containing a |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
195 |
trailing ``/`` character, it behaves identically to the *filelogs segment* |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
196 |
(see below). The final sub-segment is followed by an *empty chunk* (logically, |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
197 |
a sub-segment with filename size 0). This denotes the boundary to the |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
198 |
*filelogs segment*. |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
199 |
|
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
200 |
Filelogs Segment |
29747
aba2bb2a6d0f
help: don't try to render a section on sub-topics
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27434
diff
changeset
|
201 |
================ |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
202 |
|
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
203 |
The *filelogs segment* consists of multiple sub-segments, each |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
204 |
corresponding to an individual file whose data is being described:: |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
205 |
|
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
206 |
+--------------------------------------------------+ |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
207 |
| | | | | | |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
208 |
| filelog0 | filelog1 | filelog2 | ... | 0x0 | |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
209 |
| | | | | (4 bytes) | |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
210 |
| | | | | | |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
211 |
+--------------------------------------------------+ |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
212 |
|
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
213 |
The final filelog sub-segment is followed by an *empty chunk* (logically, |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
214 |
a sub-segment with filename size 0). This denotes the end of the segment |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
215 |
and of the overall changegroup. |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
216 |
|
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
217 |
Each filelog sub-segment consists of the following:: |
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
218 |
|
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
219 |
+------------------------------------------------------+ |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
220 |
| | | | |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
221 |
| filename length | filename | delta group | |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
222 |
| (4 bytes) | (<length - 4> bytes) | (various) | |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
223 |
| | | | |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
224 |
+------------------------------------------------------+ |
27372
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
225 |
|
a79cba6cb206
help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
226 |
That is, a *chunk* consisting of the filename (not terminated or padded) |
31213
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
227 |
followed by N chunks constituting the *delta group* for this file. The |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
228 |
*empty chunk* at the end of each *delta group* denotes the boundary to the |
9f169b7f53d5
help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents:
29747
diff
changeset
|
229 |
next filelog sub-segment. |