Mercurial > hg
diff tests/test-bundle2-exchange.t @ 27246:b288fb2724bf
wireproto: config options to disable bundle1
bundle2 is the new and preferred wire protocol format. For various
reasons, server operators may wish to force clients to use it.
One reason is performance. If a repository is stored in generaldelta,
the server must recompute deltas in order to produce the bundle1
changegroup. This can be extremely expensive. For mozilla-central,
bundle generation typically takes a few minutes. However, generating
a non-gd bundle from a generaldelta encoded mozilla-central requires
over 30 minutes of CPU! If a large repository like mozilla-central
were encoded in generaldelta and non-gd clients connected, they could
easily flood a server by cloning.
This patch gives server operators config knobs to control whether
bundle1 is allowed for push and pull operations. The default is to
support legacy bundle1 clients, making this patch backwards compatible.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 04 Dec 2015 15:12:11 -0800 |
parents | 58f1645f72c3 |
children | 37d7cf569cf3 |
line wrap: on
line diff
--- a/tests/test-bundle2-exchange.t Fri Dec 04 13:31:01 2015 -0800 +++ b/tests/test-bundle2-exchange.t Fri Dec 04 15:12:11 2015 -0800 @@ -951,3 +951,86 @@ remote: adding manifests remote: adding file changes remote: added 1 changesets with 1 changes to 1 files + + $ cd .. + +Servers can disable bundle1 for clone/pull operations + + $ killdaemons.py + $ hg init bundle2onlyserver + $ cd bundle2onlyserver + $ cat > .hg/hgrc << EOF + > [server] + > bundle1.pull = false + > EOF + + $ touch foo + $ hg -q commit -A -m initial + + $ hg serve -p $HGPORT -d --pid-file=hg.pid + $ cat hg.pid >> $DAEMON_PIDS + + $ hg --config experimental.bundle2-exp=false clone http://localhost:$HGPORT/ not-bundle2 + requesting all changes + abort: remote error: + incompatible Mercurial client; bundle2 required + (see https://www.mercurial-scm.org/wiki/IncompatibleClient) + [255] + $ killdaemons.py + +Verify the global server.bundle1 option works + + $ cat > .hg/hgrc << EOF + > [server] + > bundle1 = false + > EOF + $ hg serve -p $HGPORT -d --pid-file=hg.pid + $ cat hg.pid >> $DAEMON_PIDS + $ hg --config experimental.bundle2-exp=false clone http://localhost:$HGPORT not-bundle2 + requesting all changes + abort: remote error: + incompatible Mercurial client; bundle2 required + (see https://www.mercurial-scm.org/wiki/IncompatibleClient) + [255] + $ killdaemons.py + +Verify bundle1 pushes can be disabled + + $ cat > .hg/hgrc << EOF + > [server] + > bundle1.push = false + > [web] + > allow_push = * + > push_ssl = false + > EOF + + $ hg serve -p $HGPORT -d --pid-file=hg.pid -E error.log + $ cat hg.pid >> $DAEMON_PIDS + $ cd .. + + $ hg clone http://localhost:$HGPORT bundle2-only + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + updating to branch default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd bundle2-only + $ echo commit > foo + $ hg commit -m commit + $ hg --config experimental.bundle2-exp=false push + pushing to http://localhost:$HGPORT/ + searching for changes + abort: remote error: + incompatible Mercurial client; bundle2 required + (see https://www.mercurial-scm.org/wiki/IncompatibleClient) + [255] + + $ hg push + pushing to http://localhost:$HGPORT/ + searching for changes + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files