author | Boris Feld <boris.feld@octobus.net> |
Wed, 19 Dec 2018 15:45:29 +0100 | |
changeset 41036 | 73da729ccfef |
parent 36451 | 1fa35ca345a5 |
permissions | -rw-r--r-- |
27373
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 |
A bundle is a container for repository data. |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
2 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
3 |
Bundles are used as standalone files as well as the interchange format |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
4 |
over the wire protocol used when two Mercurial peers communicate with |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
5 |
each other. |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
6 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
7 |
Headers |
29747
aba2bb2a6d0f
help: don't try to render a section on sub-topics
Gregory Szorc <gregory.szorc@gmail.com>
parents:
27373
diff
changeset
|
8 |
======= |
27373
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
9 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
10 |
Bundles produced since Mercurial 0.7 (September 2005) have a 4 byte |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
11 |
header identifying the major bundle type. The header always begins with |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
12 |
``HG`` and the follow 2 bytes indicate the bundle type/version. Some |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
13 |
bundle types have additional data after this 4 byte header. |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
14 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
15 |
The following sections describe each bundle header/type. |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
16 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
17 |
HG10 |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
18 |
---- |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
19 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
20 |
``HG10`` headers indicate a *changegroup bundle*. This is the original |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
21 |
bundle format, so it is sometimes referred to as *bundle1*. It has been |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
22 |
present since version 0.7 (released September 2005). |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
23 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
24 |
This header is followed by 2 bytes indicating the compression algorithm |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
25 |
used for data that follows. All subsequent data following this |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
26 |
compression identifier is compressed according to the algorithm/method |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
27 |
specified. |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
28 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
29 |
Supported algorithms include the following. |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
30 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
31 |
``BZ`` |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
32 |
*bzip2* compression. |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
33 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
34 |
Bzip2 compressors emit a leading ``BZ`` header. Mercurial uses this |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
35 |
leading ``BZ`` as part of the bundle header. Therefore consumers |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
36 |
of bzip2 bundles need to *seed* the bzip2 decompressor with ``BZ`` or |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
37 |
seek the input stream back to the beginning of the algorithm component |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
38 |
of the bundle header so that decompressor input is valid. This behavior |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
39 |
is unique among supported compression algorithms. |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
40 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
41 |
Supported since version 0.7 (released December 2006). |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
42 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
43 |
``GZ`` |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
44 |
*zlib* compression. |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
45 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
46 |
Supported since version 0.9.2 (released December 2006). |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
47 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
48 |
``UN`` |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
49 |
*Uncompressed* or no compression. Unmodified changegroup data follows. |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
50 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
51 |
Supported since version 0.9.2 (released December 2006). |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
52 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
53 |
3rd party extensions may implement their own compression. However, no |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
54 |
authority reserves values for their compression algorithm identifiers. |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
55 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
56 |
HG2X |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
57 |
---- |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
58 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
59 |
``HG2X`` headers (where ``X`` is any value) denote a *bundle2* bundle. |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
60 |
Bundle2 bundles are a container format for various kinds of repository |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
61 |
data and capabilities, beyond changegroup data (which was the only data |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
62 |
supported by ``HG10`` bundles. |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
63 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
64 |
``HG20`` is currently the only defined bundle2 version. |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
65 |
|
36451
1fa35ca345a5
internals: document bundle2 format
Gregory Szorc <gregory.szorc@gmail.com>
parents:
29747
diff
changeset
|
66 |
The ``HG20`` format is documented at :hg:`help internals.bundle2`. |
27373
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
67 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
68 |
Initial ``HG20`` support was added in Mercurial 3.0 (released May |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
69 |
2014). However, bundle2 bundles were hidden behind an experimental flag |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
70 |
until version 3.5 (released August 2015), when they were enabled in the |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
71 |
wire protocol. Various commands (including ``hg bundle``) did not |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
72 |
support generating bundle2 files until Mercurial 3.6 (released November |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
73 |
2015). |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
74 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
75 |
HGS1 |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
76 |
---- |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
77 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
78 |
*Experimental* |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
79 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
80 |
A ``HGS1`` header indicates a *streaming clone bundle*. This is a bundle |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
81 |
that contains raw revlog data from a repository store. (Typically revlog |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
82 |
data is exchanged in the form of changegroups.) |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
83 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
84 |
The purpose of *streaming clone bundles* are to *clone* repository data |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
85 |
very efficiently. |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
86 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
87 |
The ``HGS1`` header is always followed by 2 bytes indicating a |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
88 |
compression algorithm of the data that follows. Only ``UN`` |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
89 |
(uncompressed data) is currently allowed. |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
90 |
|
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
91 |
``HGS1UN`` support was added as an experimental feature in version 3.6 |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
92 |
(released November 2015) as part of the initial offering of the *clone |
84784f834b3a
help: add documentation for bundle types
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
93 |
bundles* feature. |