Mercurial > hg-stable
changeset 30874:3d4afc2fdcd7 stable
bundle1: fix bundle1-denied reporting for pull over ssh
Changeset b288fb2724bf introduced a config option to have the server deny pull
using bundle1. The original protocol has not really been design to allow that
kind of error reporting so some hack was used. It turned the hack only works on
HTTP and that ssh server hangs forever when this is used. After further
digging, there is no way to report the error in a unified way. Using `ooberror`
freeze ssh and raising 'Abort' makes HTTP return a HTTP-500 without further
details. So with sadness we implement a version that dispatch according to the
protocol used.
Now the error is properly reported, but we still have ungraceful abort after
that. The protocol do not allow anything better to happen using bundle1.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Fri, 10 Feb 2017 18:06:08 +0100 |
parents | f3c5a8a4dfd0 |
children | d70971a3ae80 |
files | mercurial/wireproto.py tests/test-bundle2-exchange.t |
diffstat | 2 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/wireproto.py Fri Feb 10 18:06:12 2017 +0100 +++ b/mercurial/wireproto.py Fri Feb 10 18:06:08 2017 +0100 @@ -834,7 +834,10 @@ if not bundle1allowed(repo, 'pull'): if not exchange.bundle2requested(opts.get('bundlecaps')): - return ooberror(bundle2required) + if proto.name == 'http': + return ooberror(bundle2required) + raise error.Abort(bundle2requiredmain, + hint=bundle2requiredhint) chunks = exchange.getbundlechunks(repo, 'serve', **opts) return streamres(gen=chunks, v1compressible=True)
--- a/tests/test-bundle2-exchange.t Fri Feb 10 18:06:12 2017 +0100 +++ b/tests/test-bundle2-exchange.t Fri Feb 10 18:06:08 2017 +0100 @@ -1039,6 +1039,16 @@ [255] $ killdaemons.py + $ hg --config devel.legacy.exchange=bundle1 clone ssh://user@dummy/bundle2onlyserver not-bundle2-ssh + requesting all changes + adding changesets + remote: abort: incompatible Mercurial client; bundle2 required + remote: (see https://www.mercurial-scm.org/wiki/IncompatibleClient) + transaction abort! + rollback completed + abort: stream ended unexpectedly (got 0 bytes, expected 4) + [255] + $ cat > bundle2onlyserver/.hg/hgrc << EOF > [server] > bundle1gd = false