mercurial/help/internals/changegroups.txt
author Yuya Nishihara <yuya@tcha.org>
Sat, 24 Mar 2018 13:02:27 +0900
changeset 37100 9e6d3465f17e
parent 32139 de86a6872d06
child 40047 8e398628a3f2
permissions -rw-r--r--
url: make logginghttphandler compatible with Python 2.7.6 There wasn't a usable hook point in httplib, so we have to replace connect() to wrap the socket before self._tunnel().
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
27434
11150176a000 changegroups: add documentation for cg3
Augie Fackler <augie@google.com>
parents: 27372
diff changeset
     5
There are 3 versions of changegroups: ``1``, ``2``, and ``3``. 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
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
     7
only difference being an additional item in the *delta header*.  Version
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
     8
``3`` adds support for revlog flags in the *delta header* and optionally
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
     9
exchanging treemanifests (enabled by setting an option on the
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    10
``changegroup`` part in the bundle2).
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    11
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    12
Changegroups when not exchanging treemanifests consist of 3 logical
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    13
segments::
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    14
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
   | changeset | manifest | filelogs |
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    18
   |           |          |          |
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    19
   |           |          |          |
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    20
   +---------------------------------+
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    21
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    22
When exchanging treemanifests, there are 4 logical segments::
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    23
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
   | changeset |   root   | treemanifests | filelogs |
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    27
   |           | manifest |               |          |
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    28
   |           |          |               |          |
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
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    31
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
    32
is a framed piece of data::
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    33
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
   |  length   |           data            |
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    37
   | (4 bytes) |   (<length - 4> bytes)    |
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    38
   |           |                           |
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
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    41
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
    42
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
    43
itself).
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    44
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    45
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
    46
(``0x00000000``). We call this an *empty chunk*.
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    47
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    48
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
    49
============
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    50
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    51
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
    52
or patches against previous revisions.
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    53
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    54
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
    55
to signal the end of the delta group::
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    56
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
  | chunk0 length  | chunk0 data | chunk1 length | chunk1 data |    0x0    |
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    60
  |   (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
    61
  |                |             |               |             |           |
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    62
  +------------------------------------------------------------------------+
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    63
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    64
Each *chunk*'s data consists of the following::
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    65
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    66
  +---------------------------------------+
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
  |     delta header       |  delta data  |
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    69
  |  (various by version)  |  (various)   |
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    70
  |                        |              |
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    71
  +---------------------------------------+
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    72
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    73
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
    74
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
    75
bundle/changegroup).
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    76
27434
11150176a000 changegroups: add documentation for cg3
Augie Fackler <augie@google.com>
parents: 27372
diff changeset
    77
The *delta header* is different between versions ``1``, ``2``, and
11150176a000 changegroups: add documentation for cg3
Augie Fackler <augie@google.com>
parents: 27372
diff changeset
    78
``3`` of the changegroup format.
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    79
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    80
Version 1 (headerlen=80)::
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    81
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
   |    node    |   p1 node   |   p2 node   |  link node  |
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    85
   | (20 bytes) |  (20 bytes) |  (20 bytes) |  (20 bytes) |
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    86
   |            |             |             |             |
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
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    89
Version 2 (headerlen=100)::
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    90
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
   |    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
    94
   | (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
    95
   |            |             |             |            |            |
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
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
    98
Version 3 (headerlen=102)::
27434
11150176a000 changegroups: add documentation for cg3
Augie Fackler <augie@google.com>
parents: 27372
diff changeset
    99
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
   |            |             |             |            |            |           |
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   102
   |    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
   103
   | (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
   104
   |            |             |             |            |            |           |
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
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   107
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
   108
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
   109
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
   110
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
   111
``hg help internals.bdiff``, but briefly::
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   112
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   113
   +---------------------------------------------------------------+
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   114
   |              |            |            |                      |
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   115
   | start offset | end offset | new length |        content       |
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   116
   |  (4 bytes)   |  (4 bytes) |  (4 bytes) | (<new length> bytes) |
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   117
   |              |            |            |                      |
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   118
   +---------------------------------------------------------------+
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   119
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   120
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
   121
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   122
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
   123
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
   124
changegroup.
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   125
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   126
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
   127
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
   128
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
   129
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   130
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
   131
=================
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   132
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   133
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
   134
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
   135
the boundary to the *manifest segment*.
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   136
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   137
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
   138
================
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   139
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   140
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
   141
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
   142
root directory of the repository. Otherwise, it contains the entire
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   143
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
   144
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
   145
*filelogs segment*, depending on version and the request options).
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   146
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   147
Treemanifests Segment
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   148
---------------------
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   149
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   150
The *treemanifests segment* only exists in changegroup version ``3``, and
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   151
only if the 'treemanifest' param is part of the bundle2 changegroup part
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   152
(it is not possible to use changegroup version 3 outside of bundle2).
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   153
Aside from the filenames in the *treemanifests segment* containing a
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   154
trailing ``/`` character, it behaves identically to the *filelogs segment*
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   155
(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
   156
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
   157
*filelogs segment*.
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   158
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   159
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
   160
================
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   161
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   162
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
   163
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
   164
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   165
   +--------------------------------------------------+
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   166
   |          |          |          |     |           |
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   167
   | filelog0 | filelog1 | filelog2 | ... |    0x0    |
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   168
   |          |          |          |     | (4 bytes) |
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   169
   |          |          |          |     |           |
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   170
   +--------------------------------------------------+
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   171
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   172
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
   173
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
   174
and of the overall changegroup.
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   175
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   176
Each filelog sub-segment consists of the following::
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   177
31213
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   178
   +------------------------------------------------------+
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   179
   |                 |                      |             |
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   180
   | filename length |       filename       | delta group |
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   181
   |    (4 bytes)    | (<length - 4> bytes) |  (various)  |
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   182
   |                 |                      |             |
9f169b7f53d5 help: fix internals.changegroups
Kyle Lippincott <spectral@google.com>
parents: 29747
diff changeset
   183
   +------------------------------------------------------+
27372
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   184
a79cba6cb206 help: add documentation for changegroup formats
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   185
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
   186
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
   187
*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
   188
next filelog sub-segment.