mercurial/help/hg-ssh.8.txt
author Gregory Szorc <gregory.szorc@gmail.com>
Sat, 24 Dec 2016 15:29:32 -0700
changeset 30764 e75463e3179f
parent 30244 4e934804cafe
permissions -rw-r--r--
protocol: send application/mercurial-0.2 responses to capable clients With this commit, the HTTP transport now parses the X-HgProto-<N> header to determine what media type and compression engine to use for responses. So far, we only compress responses that are already being compressed with zlib today (stream response types to specific commands). We can expand things to cover additional response types later. The practical side-effect of this commit is that non-zlib compression engines will be used if both ends support them. This means if both ends have zstd support, zstd - not zlib - will be used to compress data! When cloning the mozilla-unified repository between a local HTTP server and client, the benefits of non-zlib compression are quite noticeable: engine server CPU (s) client CPU (s) bundle size zlib (l=6) 174.1 283.2 1,148,547,026 zstd (l=1) 99.2 267.3 1,127,513,841 zstd (l=3) 103.1 266.9 1,018,861,363 zstd (l=7) 128.3 269.7 919,190,278 zstd (l=10) 162.0 - 894,547,179 none 95.3 277.2 4,097,566,064 The default zstd compression level is 3. So if you deploy zstd capable Mercurial to your clients and servers and CPU time on your server is dominated by "getbundle" requests (clients cloning and pulling) - and my experience at Mozilla tells me this is often the case - this commit could drastically reduce your server-side CPU usage *and* save on bandwidth costs! Another benefit of this change is that server operators can install *any* compression engine. While it isn't enabled by default, the "none" compression engine can now be used to disable wire protocol compression completely. Previously, commands like "getbundle" always zlib compressed output, adding considerable overhead to generating responses. If you are on a high speed network and your server is under high load, it might be advantageous to trade bandwidth for CPU. Although, zstd at level 1 doesn't use that much CPU, so I'm not convinced that disabling compression wholesale is worthwhile. And, my data seems to indicate a slow down on the client without compression. I suspect this is due to a lack of buffering resulting in an increase in socket read() calls and/or the fact we're transferring an extra 3 GB of data (parsing HTTP chunked transfer and processing extra TCP packets can add up). This is definitely worth investigating and optimizing. But since the "none" compressor isn't enabled by default, I'm inclined to punt on this issue. This commit introduces tons of tests. Some of these should arguably have been implemented on previous commits. But it was difficult to test without the server functionality in place.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29090
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
     1
========
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
     2
 hg-ssh
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
     3
========
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
     4
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
     5
----------------------------------------
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
     6
restricted ssh login shell for Mercurial
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
     7
----------------------------------------
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
     8
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
     9
:Author:         Thomas Arendsen Hein <thomas@intevation.de>
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    10
:Organization:   Mercurial
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    11
:Manual section: 8
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    12
:Manual group:   Mercurial Manual
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    13
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    14
.. contents::
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    15
   :backlinks: top
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    16
   :class: htmlonly
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    17
   :depth: 1
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    18
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    19
Synopsis
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    20
""""""""
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    21
**hg-ssh** repositories...
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    22
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    23
Description
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    24
"""""""""""
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    25
**hg-ssh** is a wrapper for ssh access to a limited set of mercurial repos.
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    26
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    27
To be used in ~/.ssh/authorized_keys with the "command" option, see sshd(8):
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    28
command="hg-ssh path/to/repo1 /path/to/repo2 ~/repo3 ~user/repo4" ssh-dss ...
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    29
(probably together with these other useful options:
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    30
no-port-forwarding,no-X11-forwarding,no-agent-forwarding)
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    31
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    32
This allows pull/push over ssh from/to the repositories given as arguments.
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    33
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    34
If all your repositories are subdirectories of a common directory, you can
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    35
allow shorter paths with:
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    36
command="cd path/to/my/repositories && hg-ssh repo1 subdir/repo2"
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    37
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    38
You can use pattern matching of your normal shell, e.g.:
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    39
command="cd repos && hg-ssh user/thomas/* projects/{mercurial,foo}"
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    40
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    41
You can also add a --read-only flag to allow read-only access to a key, e.g.:
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    42
command="hg-ssh --read-only repos/\*"
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    43
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    44
Bugs
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    45
""""
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    46
Probably lots, please post them to the mailing list (see Resources_
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    47
below) when you find them.
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    48
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    49
See Also
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    50
""""""""
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    51
|hg(1)|_
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    52
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    53
Author
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    54
""""""
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    55
Written by Matt Mackall <mpm@selenic.com>
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    56
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    57
Resources
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    58
"""""""""
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    59
Main Web Site: https://mercurial-scm.org/
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    60
30244
4e934804cafe help: replace selenic.com by mercurial-scm.org in man pages
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29090
diff changeset
    61
Source code repository: https://www.mercurial-scm.org/repo/hg
29090
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    62
30244
4e934804cafe help: replace selenic.com by mercurial-scm.org in man pages
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 29090
diff changeset
    63
Mailing list: https://www.mercurial-scm.org/mailman/listinfo/mercurial/
29090
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    64
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    65
Copying
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    66
"""""""
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    67
Copyright (C) 2005-2016 Matt Mackall.
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    68
Free use of this software is granted under the terms of the GNU General
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    69
Public License version 2 or any later version.
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    70
7b52cb384c38 hg-ssh: copy doc string to man page
Sean Farley <sean@farley.io>
parents:
diff changeset
    71
.. include:: common.txt