mercurial/help/internals/wireprotocol.txt
author Gregory Szorc <gregory.szorc@gmail.com>
Sun, 20 Nov 2016 16:56:21 -0800
changeset 30461 d195fa651b51
parent 29865 80c11c1a64bf
child 30760 753b9d43ca81
permissions -rw-r--r--
bdiff: don't check border condition in loop This is pretty much a copy of d500ddae7494, just to a different loop. The condition `p == plast` (`plast == a + len - 1`) was only true on the final iteration of the loop. So it was wasteful to check for it on every iteration. We decrease the iteration count by 1 and add an explicit check for `p == plast` after the loop. Again, we see modest wins. From the mozilla-unified repository: $ perfbdiff -m 3041e4d59df2 ! wall 0.035502 comb 0.040000 user 0.040000 sys 0.000000 (best of 100) ! wall 0.030480 comb 0.030000 user 0.030000 sys 0.000000 (best of 100) $ perfbdiff 0e9928989e9c --alldata --count 100 ! wall 4.097394 comb 4.100000 user 4.100000 sys 0.000000 (best of 3) ! wall 3.597798 comb 3.600000 user 3.600000 sys 0.000000 (best of 3) The 2nd example throws a total of ~3.3GB of data at bdiff. This change increases the throughput from ~811 MB/s to ~924 MB/s.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29859
a1092e2d70a3 help: internals topic for wire protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     1
The Mercurial wire protocol is a request-response based protocol
a1092e2d70a3 help: internals topic for wire protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     2
with multiple wire representations.
a1092e2d70a3 help: internals topic for wire protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     3
a1092e2d70a3 help: internals topic for wire protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     4
Each request is modeled as a command name, a dictionary of arguments, and
a1092e2d70a3 help: internals topic for wire protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     5
optional raw input. Command arguments and their types are intrinsic
a1092e2d70a3 help: internals topic for wire protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     6
properties of commands. So is the response type of the command. This means
a1092e2d70a3 help: internals topic for wire protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     7
clients can't always send arbitrary arguments to servers and servers can't
a1092e2d70a3 help: internals topic for wire protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     8
return multiple response types.
a1092e2d70a3 help: internals topic for wire protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     9
a1092e2d70a3 help: internals topic for wire protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    10
The protocol is synchronous and does not support multiplexing (concurrent
a1092e2d70a3 help: internals topic for wire protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    11
commands).
29860
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    12
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    13
Transport Protocols
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    14
===================
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    15
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    16
HTTP Transport
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    17
--------------
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    18
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    19
Commands are issued as HTTP/1.0 or HTTP/1.1 requests. Commands are
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    20
sent to the base URL of the repository with the command name sent in
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    21
the ``cmd`` query string parameter. e.g.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    22
``https://example.com/repo?cmd=capabilities``. The HTTP method is ``GET``
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    23
or ``POST`` depending on the command and whether there is a request
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    24
body.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    25
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    26
Command arguments can be sent multiple ways.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    27
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    28
The simplest is part of the URL query string using ``x-www-form-urlencoded``
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    29
encoding (see Python's ``urllib.urlencode()``. However, many servers impose
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    30
length limitations on the URL. So this mechanism is typically only used if
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    31
the server doesn't support other mechanisms.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    32
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    33
If the server supports the ``httpheader`` capability, command arguments can
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    34
be sent in HTTP request headers named ``X-HgArg-<N>`` where ``<N>`` is an
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    35
integer starting at 1. A ``x-www-form-urlencoded`` representation of the
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    36
arguments is obtained. This full string is then split into chunks and sent
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    37
in numbered ``X-HgArg-<N>`` headers. The maximum length of each HTTP header
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    38
is defined by the server in the ``httpheader`` capability value, which defaults
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    39
to ``1024``. The server reassembles the encoded arguments string by
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    40
concatenating the ``X-HgArg-<N>`` headers then URL decodes them into a
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    41
dictionary.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    42
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    43
The list of ``X-HgArg-<N>`` headers should be added to the ``Vary`` request
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    44
header to instruct caches to take these headers into consideration when caching
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    45
requests.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    46
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    47
If the server supports the ``httppostargs`` capability, the client
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    48
may send command arguments in the HTTP request body as part of an
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    49
HTTP POST request. The command arguments will be URL encoded just like
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    50
they would for sending them via HTTP headers. However, no splitting is
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    51
performed: the raw arguments are included in the HTTP request body.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    52
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    53
The client sends a ``X-HgArgs-Post`` header with the string length of the
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    54
encoded arguments data. Additional data may be included in the HTTP
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    55
request body immediately following the argument data. The offset of the
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    56
non-argument data is defined by the ``X-HgArgs-Post`` header. The
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    57
``X-HgArgs-Post`` header is not required if there is no argument data.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    58
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    59
Additional command data can be sent as part of the HTTP request body. The
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    60
default ``Content-Type`` when sending data is ``application/mercurial-0.1``.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    61
A ``Content-Length`` header is currently always sent.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    62
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    63
Example HTTP requests::
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    64
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    65
    GET /repo?cmd=capabilities
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    66
    X-HgArg-1: foo=bar&baz=hello%20world
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    67
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    68
The ``Content-Type`` HTTP response header identifies the response as coming
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    69
from Mercurial and can also be used to signal an error has occurred.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    70
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    71
The ``application/mercurial-0.1`` media type indicates a generic Mercurial
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    72
response. It matches the media type sent by the client.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    73
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    74
The ``application/hg-error`` media type indicates a generic error occurred.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    75
The content of the HTTP response body typically holds text describing the
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    76
error.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    77
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    78
The ``application/hg-changegroup`` media type indicates a changegroup response
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    79
type.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    80
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    81
Clients also accept the ``text/plain`` media type. All other media
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    82
types should cause the client to error.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    83
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    84
Clients should issue a ``User-Agent`` request header that identifies the client.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    85
The server should not use the ``User-Agent`` for feature detection.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    86
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    87
A command returning a ``string`` response issues the
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    88
``application/mercurial-0.1`` media type and the HTTP response body contains
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    89
the raw string value. A ``Content-Length`` header is typically issued.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    90
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    91
A command returning a ``stream`` response issues the
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    92
``application/mercurial-0.1`` media type and the HTTP response is typically
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    93
using *chunked transfer* (``Transfer-Encoding: chunked``).
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    94
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    95
SSH Transport
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    96
=============
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    97
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    98
The SSH transport is a custom text-based protocol suitable for use over any
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
    99
bi-directional stream transport. It is most commonly used with SSH.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   100
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   101
A SSH transport server can be started with ``hg serve --stdio``. The stdin,
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   102
stderr, and stdout file descriptors of the started process are used to exchange
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   103
data. When Mercurial connects to a remote server over SSH, it actually starts
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   104
a ``hg serve --stdio`` process on the remote server.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   105
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   106
Commands are issued by sending the command name followed by a trailing newline
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   107
``\n`` to the server. e.g. ``capabilities\n``.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   108
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   109
Command arguments are sent in the following format::
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   110
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   111
    <argument> <length>\n<value>
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   112
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   113
That is, the argument string name followed by a space followed by the
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   114
integer length of the value (expressed as a string) followed by a newline
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   115
(``\n``) followed by the raw argument value.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   116
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   117
Dictionary arguments are encoded differently::
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   118
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   119
    <argument> <# elements>\n
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   120
    <key1> <length1>\n<value1>
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   121
    <key2> <length2>\n<value2>
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   122
    ...
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   123
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   124
Non-argument data is sent immediately after the final argument value. It is
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   125
encoded in chunks::
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   126
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   127
    <length>\n<data>
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   128
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   129
Each command declares a list of supported arguments and their types. If a
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   130
client sends an unknown argument to the server, the server should abort
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   131
immediately. The special argument ``*`` in a command's definition indicates
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   132
that all argument names are allowed.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   133
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   134
The definition of supported arguments and types is initially made when a
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   135
new command is implemented. The client and server must initially independently
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   136
agree on the arguments and their types. This initial set of arguments can be
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   137
supplemented through the presence of *capabilities* advertised by the server.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   138
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   139
Each command has a defined expected response type.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   140
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   141
A ``string`` response type is a length framed value. The response consists of
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   142
the string encoded integer length of a value followed by a newline (``\n``)
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   143
followed by the value. Empty values are allowed (and are represented as
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   144
``0\n``).
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   145
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   146
A ``stream`` response type consists of raw bytes of data. There is no framing.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   147
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   148
A generic error response type is also supported. It consists of a an error
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   149
message written to ``stderr`` followed by ``\n-\n``. In addition, ``\n`` is
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   150
written to ``stdout``.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   151
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   152
If the server receives an unknown command, it will send an empty ``string``
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   153
response.
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   154
b42c26b0a785 help: document wire protocol transport protocols
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29859
diff changeset
   155
The server terminates if it receives an empty command (a ``\n`` character).
29863
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   156
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   157
Capabilities
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   158
============
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   159
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   160
Servers advertise supported wire protocol features. This allows clients to
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   161
probe for server features before blindly calling a command or passing a
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   162
specific argument.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   163
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   164
The server's features are exposed via a *capabilities* string. This is a
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   165
space-delimited string of tokens/features. Some features are single words
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   166
like ``lookup`` or ``batch``. Others are complicated key-value pairs
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   167
advertising sub-features. e.g. ``httpheader=2048``. When complex, non-word
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   168
values are used, each feature name can define its own encoding of sub-values.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   169
Comma-delimited and ``x-www-form-urlencoded`` values are common.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   170
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   171
The following document capabilities defined by the canonical Mercurial server
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   172
implementation.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   173
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   174
batch
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   175
-----
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   176
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   177
Whether the server supports the ``batch`` command.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   178
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   179
This capability/command was introduced in Mercurial 1.9 (released July 2011).
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   180
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   181
branchmap
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   182
---------
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   183
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   184
Whether the server supports the ``branchmap`` command.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   185
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   186
This capability/command was introduced in Mercurial 1.3 (released July 2009).
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   187
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   188
bundle2-exp
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   189
-----------
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   190
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   191
Precursor to ``bundle2`` capability that was used before bundle2 was a
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   192
stable feature.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   193
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   194
This capability was introduced in Mercurial 3.0 behind an experimental
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   195
flag. This capability should not be observed in the wild.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   196
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   197
bundle2
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   198
-------
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   199
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   200
Indicates whether the server supports the ``bundle2`` data exchange format.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   201
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   202
The value of the capability is a URL quoted, newline (``\n``) delimited
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   203
list of keys or key-value pairs.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   204
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   205
A key is simply a URL encoded string.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   206
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   207
A key-value pair is a URL encoded key separated from a URL encoded value by
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   208
an ``=``. If the value is a list, elements are delimited by a ``,`` after
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   209
URL encoding.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   210
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   211
For example, say we have the values::
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   212
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   213
  {'HG20': [], 'changegroup': ['01', '02'], 'digests': ['sha1', 'sha512']}
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   214
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   215
We would first construct a string::
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   216
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   217
  HG20\nchangegroup=01,02\ndigests=sha1,sha512
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   218
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   219
We would then URL quote this string::
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   220
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   221
  HG20%0Achangegroup%3D01%2C02%0Adigests%3Dsha1%2Csha512
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   222
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   223
This capability was introduced in Mercurial 3.4 (released May 2015).
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   224
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   225
changegroupsubset
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   226
-----------------
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   227
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   228
Whether the server supports the ``changegroupsubset`` command.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   229
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   230
This capability was introduced in Mercurial 0.9.2 (released December
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   231
2006).
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   232
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   233
This capability was introduced at the same time as the ``lookup``
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   234
capability/command.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   235
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   236
getbundle
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   237
---------
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   238
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   239
Whether the server supports the ``getbundle`` command.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   240
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   241
This capability was introduced in Mercurial 1.9 (released July 2011).
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   242
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   243
httpheader
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   244
----------
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   245
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   246
Whether the server supports receiving command arguments via HTTP request
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   247
headers.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   248
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   249
The value of the capability is an integer describing the max header
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   250
length that clients should send. Clients should ignore any content after a
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   251
comma in the value, as this is reserved for future use.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   252
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   253
This capability was introduced in Mercurial 1.9 (released July 2011).
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   254
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   255
httppostargs
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   256
------------
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   257
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   258
**Experimental**
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   259
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   260
Indicates that the server supports and prefers clients send command arguments
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   261
via a HTTP POST request as part of the request body.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   262
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   263
This capability was introduced in Mercurial 3.8 (released May 2016).
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   264
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   265
known
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   266
-----
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   267
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   268
Whether the server supports the ``known`` command.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   269
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   270
This capability/command was introduced in Mercurial 1.9 (released July 2011).
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   271
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   272
lookup
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   273
------
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   274
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   275
Whether the server supports the ``lookup`` command.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   276
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   277
This capability was introduced in Mercurial 0.9.2 (released December
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   278
2006).
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   279
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   280
This capability was introduced at the same time as the ``changegroupsubset``
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   281
capability/command.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   282
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   283
pushkey
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   284
-------
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   285
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   286
Whether the server supports the ``pushkey`` and ``listkeys`` commands.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   287
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   288
This capability was introduced in Mercurial 1.6 (released July 2010).
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   289
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   290
standardbundle
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   291
--------------
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   292
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   293
**Unsupported**
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   294
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   295
This capability was introduced during the Mercurial 0.9.2 development cycle in
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   296
2006. It was never present in a release, as it was replaced by the ``unbundle``
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   297
capability. This capability should not be encountered in the wild.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   298
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   299
stream-preferred
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   300
----------------
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   301
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   302
If present the server prefers that clients clone using the streaming clone
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   303
protocol (``hg clone --uncompressed``) rather than the standard
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   304
changegroup/bundle based protocol.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   305
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   306
This capability was introduced in Mercurial 2.2 (released May 2012).
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   307
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   308
streamreqs
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   309
----------
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   310
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   311
Indicates whether the server supports *streaming clones* and the *requirements*
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   312
that clients must support to receive it.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   313
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   314
If present, the server supports the ``stream_out`` command, which transmits
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   315
raw revlogs from the repository instead of changegroups. This provides a faster
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   316
cloning mechanism at the expense of more bandwidth used.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   317
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   318
The value of this capability is a comma-delimited list of repo format
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   319
*requirements*. These are requirements that impact the reading of data in
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   320
the ``.hg/store`` directory. An example value is
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   321
``streamreqs=generaldelta,revlogv1`` indicating the server repo requires
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   322
the ``revlogv1`` and ``generaldelta`` requirements.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   323
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   324
If the only format requirement is ``revlogv1``, the server may expose the
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   325
``stream`` capability instead of the ``streamreqs`` capability.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   326
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   327
This capability was introduced in Mercurial 1.7 (released November 2010).
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   328
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   329
stream
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   330
------
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   331
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   332
Whether the server supports *streaming clones* from ``revlogv1`` repos.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   333
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   334
If present, the server supports the ``stream_out`` command, which transmits
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   335
raw revlogs from the repository instead of changegroups. This provides a faster
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   336
cloning mechanism at the expense of more bandwidth used.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   337
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   338
This capability was introduced in Mercurial 0.9.1 (released July 2006).
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   339
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   340
When initially introduced, the value of the capability was the numeric
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   341
revlog revision. e.g. ``stream=1``. This indicates the changegroup is using
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   342
``revlogv1``. This simple integer value wasn't powerful enough, so the
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   343
``streamreqs`` capability was invented to handle cases where the repo
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   344
requirements have more than just ``revlogv1``. Newer servers omit the
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   345
``=1`` since it was the only value supported and the value of ``1`` can
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   346
be implied by clients.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   347
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   348
unbundlehash
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   349
------------
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   350
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   351
Whether the ``unbundle`` commands supports receiving a hash of all the
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   352
heads instead of a list.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   353
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   354
For more, see the documentation for the ``unbundle`` command.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   355
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   356
This capability was introduced in Mercurial 1.9 (released July 2011).
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   357
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   358
unbundle
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   359
--------
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   360
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   361
Whether the server supports pushing via the ``unbundle`` command.
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   362
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   363
This capability/command has been present since Mercurial 0.9.1 (released
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   364
July 2006).
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   365
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   366
Mercurial 0.9.2 (released December 2006) added values to the capability
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   367
indicating which bundle types the server supports receiving. This value is a
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   368
comma-delimited list. e.g. ``HG10GZ,HG10BZ,HG10UN``. The order of values
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   369
reflects the priority/preference of that type, where the first value is the
2435ba6c82e6 help: document wire protocol capabilities
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29860
diff changeset
   370
most preferred type.
29864
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   371
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   372
Handshake Protocol
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   373
==================
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   374
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   375
While not explicitly required, it is common for clients to perform a
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   376
*handshake* when connecting to a server. The handshake accomplishes 2 things:
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   377
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   378
* Obtaining capabilities and other server features
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   379
* Flushing extra server output (e.g. SSH servers may print extra text
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   380
  when connecting that may confuse the wire protocol)
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   381
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   382
This isn't a traditional *handshake* as far as network protocols go because
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   383
there is no persistent state as a result of the handshake: the handshake is
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   384
simply the issuing of commands and commands are stateless.
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   385
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   386
The canonical clients perform a capabilities lookup at connection establishment
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   387
time. This is because clients must assume a server only supports the features
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   388
of the original Mercurial server implementation until proven otherwise (from
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   389
advertised capabilities). Nearly every server running today supports features
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   390
that weren't present in the original Mercurial server implementation. Rather
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   391
than wait for a client to perform functionality that needs to consult
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   392
capabilities, it issues the lookup at connection start to avoid any delay later.
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   393
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   394
For HTTP servers, the client sends a ``capabilities`` command request as
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   395
soon as the connection is established. The server responds with a capabilities
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   396
string, which the client parses.
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   397
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   398
For SSH servers, the client sends the ``hello`` command (no arguments)
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   399
and a ``between`` command with the ``pairs`` argument having the value
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   400
``0000000000000000000000000000000000000000-0000000000000000000000000000000000000000``.
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   401
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   402
The ``between`` command has been supported since the original Mercurial
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   403
server. Requesting the empty range will return a ``\n`` string response,
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   404
which will be encoded as ``1\n\n`` (value length of ``1`` followed by a newline
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   405
followed by the value, which happens to  be a newline).
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   406
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   407
The ``hello`` command was later introduced. Servers supporting it will issue
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   408
a response to that command before sending the ``1\n\n`` response to the
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   409
``between`` command. Servers not supporting ``hello`` will send an empty
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   410
response (``0\n``).
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   411
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   412
In addition to the expected output from the ``hello`` and ``between`` commands,
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   413
servers may also send other output, such as *message of the day (MOTD)*
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   414
announcements. Clients assume servers will send this output before the
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   415
Mercurial server replies to the client-issued commands. So any server output
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   416
not conforming to the expected command responses is assumed to be not related
f0d47aca1d47 help: document wire protocol "handshake" protocol
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29863
diff changeset
   417
to Mercurial and can be ignored.
29865
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   418
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   419
Commands
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   420
========
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   421
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   422
This section contains a list of all wire protocol commands implemented by
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   423
the canonical Mercurial server.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   424
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   425
batch
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   426
-----
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   427
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   428
Issue multiple commands while sending a single command request. The purpose
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   429
of this command is to allow a client to issue multiple commands while avoiding
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   430
multiple round trips to the server therefore enabling commands to complete
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   431
quicker.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   432
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   433
The command accepts a ``cmds`` argument that contains a list of commands to
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   434
execute.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   435
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   436
The value of ``cmds`` is a ``;`` delimited list of strings. Each string has the
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   437
form ``<command> <arguments>``. That is, the command name followed by a space
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   438
followed by an argument string.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   439
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   440
The argument string is a ``,`` delimited list of ``<key>=<value>`` values
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   441
corresponding to command arguments. Both the argument name and value are
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   442
escaped using a special substitution map::
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   443
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   444
   : -> :c
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   445
   , -> :o
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   446
   ; -> :s
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   447
   = -> :e
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   448
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   449
The response type for this command is ``string``. The value contains a
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   450
``;`` delimited list of responses for each requested command. Each value
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   451
in this list is escaped using the same substitution map used for arguments.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   452
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   453
If an error occurs, the generic error response may be sent.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   454
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   455
between
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   456
-------
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   457
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   458
(Legacy command used for discovery in old clients)
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   459
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   460
Obtain nodes between pairs of nodes.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   461
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   462
The ``pairs`` arguments contains a space-delimited list of ``-`` delimited
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   463
hex node pairs. e.g.::
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   464
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   465
   a072279d3f7fd3a4aa7ffa1a5af8efc573e1c896-6dc58916e7c070f678682bfe404d2e2d68291a18
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   466
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   467
Return type is a ``string``. Value consists of lines corresponding to each
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   468
requested range. Each line contains a space-delimited list of hex nodes.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   469
A newline ``\n`` terminates each line, including the last one.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   470
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   471
branchmap
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   472
---------
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   473
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   474
Obtain heads in named branches.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   475
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   476
Accepts no arguments. Return type is a ``string``.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   477
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   478
Return value contains lines with URL encoded branch names followed by a space
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   479
followed by a space-delimited list of hex nodes of heads on that branch.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   480
e.g.::
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   481
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   482
    default a072279d3f7fd3a4aa7ffa1a5af8efc573e1c896 6dc58916e7c070f678682bfe404d2e2d68291a18
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   483
    stable baae3bf31522f41dd5e6d7377d0edd8d1cf3fccc
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   484
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   485
There is no trailing newline.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   486
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   487
branches
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   488
--------
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   489
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   490
Obtain ancestor changesets of specific nodes back to a branch point.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   491
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   492
Despite the name, this command has nothing to do with Mercurial named branches.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   493
Instead, it is related to DAG branches.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   494
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   495
The command accepts a ``nodes`` argument, which is a string of space-delimited
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   496
hex nodes.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   497
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   498
For each node requested, the server will find the first ancestor node that is
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   499
a DAG root or is a merge.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   500
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   501
Return type is a ``string``. Return value contains lines with result data for
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   502
each requested node. Each line contains space-delimited nodes followed by a
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   503
newline (``\n``). The 4 nodes reported on each line correspond to the requested
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   504
node, the ancestor node found, and its 2 parent nodes (which may be the null
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   505
node).
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   506
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   507
capabilities
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   508
------------
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   509
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   510
Obtain the capabilities string for the repo.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   511
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   512
Unlike the ``hello`` command, the capabilities string is not prefixed.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   513
There is no trailing newline.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   514
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   515
This command does not accept any arguments. Return type is a ``string``.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   516
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   517
changegroup
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   518
-----------
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   519
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   520
(Legacy command: use ``getbundle`` instead)
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   521
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   522
Obtain a changegroup version 1 with data for changesets that are
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   523
descendants of client-specified changesets.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   524
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   525
The ``roots`` arguments contains a list of space-delimited hex nodes.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   526
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   527
The server responds with a changegroup version 1 containing all
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   528
changesets between the requested root/base nodes and the repo's head nodes
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   529
at the time of the request.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   530
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   531
The return type is a ``stream``.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   532
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   533
changegroupsubset
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   534
-----------------
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   535
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   536
(Legacy command: use ``getbundle`` instead)
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   537
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   538
Obtain a changegroup version 1 with data for changesetsets between
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   539
client specified base and head nodes.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   540
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   541
The ``bases`` argument contains a list of space-delimited hex nodes.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   542
The ``heads`` argument contains a list of space-delimited hex nodes.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   543
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   544
The server responds with a changegroup version 1 containing all
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   545
changesets between the requested base and head nodes at the time of the
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   546
request.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   547
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   548
The return type is a ``stream``.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   549
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   550
clonebundles
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   551
------------
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   552
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   553
Obtains a manifest of bundle URLs available to seed clones.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   554
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   555
Each returned line contains a URL followed by metadata. See the
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   556
documentation in the ``clonebundles`` extension for more.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   557
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   558
The return type is a ``string``.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   559
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   560
getbundle
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   561
---------
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   562
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   563
Obtain a bundle containing repository data.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   564
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   565
This command accepts the following arguments:
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   566
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   567
heads
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   568
   List of space-delimited hex nodes of heads to retrieve.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   569
common
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   570
   List of space-delimited hex nodes that the client has in common with the
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   571
   server.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   572
obsmarkers
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   573
   Boolean indicating whether to include obsolescence markers as part
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   574
   of the response. Only works with bundle2.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   575
bundlecaps
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   576
   Comma-delimited set of strings defining client bundle capabilities.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   577
listkeys
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   578
   Comma-delimited list of strings of ``pushkey`` namespaces. For each
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   579
   namespace listed, a bundle2 part will be included with the content of
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   580
   that namespace.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   581
cg
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   582
   Boolean indicating whether changegroup data is requested.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   583
cbattempted
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   584
   Boolean indicating whether the client attempted to use the *clone bundles*
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   585
   feature before performing this request.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   586
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   587
The return type on success is a ``stream`` where the value is bundle.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   588
On the HTTP transport, the response is zlib compressed.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   589
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   590
If an error occurs, a generic error response can be sent.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   591
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   592
Unless the client sends a false value for the ``cg`` argument, the returned
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   593
bundle contains a changegroup with the nodes between the specified ``common``
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   594
and ``heads`` nodes. Depending on the command arguments, the type and content
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   595
of the returned bundle can vary significantly.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   596
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   597
The default behavior is for the server to send a raw changegroup version
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   598
``01`` response.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   599
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   600
If the ``bundlecaps`` provided by the client contain a value beginning
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   601
with ``HG2``, a bundle2 will be returned. The bundle2 data may contain
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   602
additional repository data, such as ``pushkey`` namespace values.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   603
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   604
heads
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   605
-----
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   606
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   607
Returns a list of space-delimited hex nodes of repository heads followed
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   608
by a newline. e.g.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   609
``a9eeb3adc7ddb5006c088e9eda61791c777cbf7c 31f91a3da534dc849f0d6bfc00a395a97cf218a1\n``
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   610
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   611
This command does not accept any arguments. The return type is a ``string``.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   612
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   613
hello
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   614
-----
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   615
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   616
Returns lines describing interesting things about the server in an RFC-822
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   617
like format.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   618
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   619
Currently, the only line defines the server capabilities. It has the form::
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   620
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   621
    capabilities: <value>
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   622
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   623
See above for more about the capabilities string.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   624
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   625
SSH clients typically issue this command as soon as a connection is
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   626
established.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   627
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   628
This command does not accept any arguments. The return type is a ``string``.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   629
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   630
listkeys
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   631
--------
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   632
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   633
List values in a specified ``pushkey`` namespace.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   634
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   635
The ``namespace`` argument defines the pushkey namespace to operate on.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   636
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   637
The return type is a ``string``. The value is an encoded dictionary of keys.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   638
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   639
Key-value pairs are delimited by newlines (``\n``). Within each line, keys and
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   640
values are separated by a tab (``\t``). Keys and values are both strings.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   641
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   642
lookup
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   643
------
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   644
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   645
Try to resolve a value to a known repository revision.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   646
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   647
The ``key`` argument is converted from bytes to an
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   648
``encoding.localstr`` instance then passed into
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   649
``localrepository.__getitem__`` in an attempt to resolve it.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   650
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   651
The return type is a ``string``.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   652
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   653
Upon successful resolution, returns ``1 <hex node>\n``. On failure,
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   654
returns ``0 <error string>\n``. e.g.::
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   655
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   656
   1 273ce12ad8f155317b2c078ec75a4eba507f1fba\n
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   657
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   658
   0 unknown revision 'foo'\n
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   659
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   660
known
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   661
-----
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   662
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   663
Determine whether multiple nodes are known.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   664
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   665
The ``nodes`` argument is a list of space-delimited hex nodes to check
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   666
for existence.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   667
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   668
The return type is ``string``.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   669
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   670
Returns a string consisting of ``0``s and ``1``s indicating whether nodes
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   671
are known. If the Nth node specified in the ``nodes`` argument is known,
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   672
a ``1`` will be returned at byte offset N. If the node isn't known, ``0``
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   673
will be present at byte offset N.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   674
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   675
There is no trailing newline.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   676
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   677
pushkey
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   678
-------
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   679
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   680
Set a value using the ``pushkey`` protocol.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   681
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   682
Accepts arguments ``namespace``, ``key``, ``old``, and ``new``, which
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   683
correspond to the pushkey namespace to operate on, the key within that
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   684
namespace to change, the old value (which may be empty), and the new value.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   685
All arguments are string types.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   686
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   687
The return type is a ``string``. The value depends on the transport protocol.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   688
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   689
The SSH transport sends a string encoded integer followed by a newline
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   690
(``\n``) which indicates operation result. The server may send additional
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   691
output on the ``stderr`` stream that should be displayed to the user.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   692
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   693
The HTTP transport sends a string encoded integer followed by a newline
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   694
followed by additional server output that should be displayed to the user.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   695
This may include output from hooks, etc.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   696
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   697
The integer result varies by namespace. ``0`` means an error has occurred
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   698
and there should be additional output to display to the user.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   699
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   700
stream_out
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   701
----------
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   702
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   703
Obtain *streaming clone* data.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   704
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   705
The return type is either a ``string`` or a ``stream``, depending on
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   706
whether the request was fulfilled properly.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   707
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   708
A return value of ``1\n`` indicates the server is not configured to serve
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   709
this data. If this is seen by the client, they may not have verified the
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   710
``stream`` capability is set before making the request.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   711
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   712
A return value of ``2\n`` indicates the server was unable to lock the
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   713
repository to generate data.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   714
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   715
All other responses are a ``stream`` of bytes. The first line of this data
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   716
contains 2 space-delimited integers corresponding to the path count and
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   717
payload size, respectively::
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   718
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   719
    <path count> <payload size>\n
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   720
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   721
The ``<payload size>`` is the total size of path data: it does not include
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   722
the size of the per-path header lines.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   723
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   724
Following that header are ``<path count>`` entries. Each entry consists of a
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   725
line with metadata followed by raw revlog data. The line consists of::
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   726
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   727
    <store path>\0<size>\n
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   728
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   729
The ``<store path>`` is the encoded store path of the data that follows.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   730
``<size>`` is the amount of data for this store path/revlog that follows the
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   731
newline.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   732
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   733
There is no trailer to indicate end of data. Instead, the client should stop
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   734
reading after ``<path count>`` entries are consumed.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   735
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   736
unbundle
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   737
--------
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   738
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   739
Send a bundle containing data (usually changegroup data) to the server.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   740
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   741
Accepts the argument ``heads``, which is a space-delimited list of hex nodes
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   742
corresponding to server repository heads observed by the client. This is used
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   743
to detect race conditions and abort push operations before a server performs
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   744
too much work or a client transfers too much data.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   745
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   746
The request payload consists of a bundle to be applied to the repository,
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   747
similarly to as if :hg:`unbundle` were called.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   748
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   749
In most scenarios, a special ``push response`` type is returned. This type
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   750
contains an integer describing the change in heads as a result of the
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   751
operation. A value of ``0`` indicates nothing changed. ``1`` means the number
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   752
of heads remained the same. Values ``2`` and larger indicate the number of
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   753
added heads minus 1. e.g. ``3`` means 2 heads were added. Negative values
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   754
indicate the number of fewer heads, also off by 1. e.g. ``-2`` means there
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   755
is 1 fewer head.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   756
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   757
The encoding of the ``push response`` type varies by transport.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   758
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   759
For the SSH transport, this type is composed of 2 ``string`` responses: an
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   760
empty response (``0\n``) followed by the integer result value. e.g.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   761
``1\n2``. So the full response might be ``0\n1\n2``.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   762
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   763
For the HTTP transport, the response is a ``string`` type composed of an
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   764
integer result value followed by a newline (``\n``) followed by string
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   765
content holding server output that should be displayed on the client (output
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   766
hooks, etc).
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   767
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   768
In some cases, the server may respond with a ``bundle2`` bundle. In this
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   769
case, the response type is ``stream``. For the HTTP transport, the response
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   770
is zlib compressed.
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   771
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   772
The server may also respond with a generic error type, which contains a string
80c11c1a64bf help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29864
diff changeset
   773
indicating the failure.