Mercurial > hg-stable
changeset 35790:c1b9eb15a51c
bundle2: don't advertise stream bundle2 capability when feature disabled
The server.uncompressed config option can be used to disable streaming
clones. While the top-level capability to advertise streaming clone
support isn't advertised when this option is set, we were still sending
the bundle2-level capabilities advertising support for stream parts.
It makes sense to not advertise that support when streaming clones
are globally disabled.
If the structure of the new code seems a bit odd, it is because we'll
have to further tweak the behavior in commit(s) ahead.
Differential Revision: https://phab.mercurial-scm.org/D1929
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 22 Jan 2018 12:21:15 -0800 |
parents | 8ed5f7609728 |
children | 9adae6a20e1f |
files | mercurial/bundle2.py tests/test-clone-uncompressed.t |
diffstat | 2 files changed, 15 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bundle2.py Mon Jan 22 12:19:45 2018 -0800 +++ b/mercurial/bundle2.py Mon Jan 22 12:21:15 2018 -0800 @@ -1519,8 +1519,20 @@ caps['checkheads'] = ('related',) if 'phases' in repo.ui.configlist('devel', 'legacy.exchange'): caps.pop('phases') - if not repo.ui.configbool('experimental', 'bundle2.stream'): - caps.pop('stream') + + # Don't advertise stream clone support in server mode if not configured. + if role == 'server': + streamsupported = repo.ui.configbool('server', 'uncompressed', + untrusted=True) + featuresupported = repo.ui.configbool('experimental', 'bundle2.stream') + + if not streamsupported or not featuresupported: + caps.pop('stream') + # role == 'client' + else: + if not repo.ui.configbool('experimental', 'bundle2.stream'): + caps.pop('stream') + return caps def bundle2caps(remote):
--- a/tests/test-clone-uncompressed.t Mon Jan 22 12:19:45 2018 -0800 +++ b/tests/test-clone-uncompressed.t Mon Jan 22 12:21:15 2018 -0800 @@ -102,7 +102,7 @@ Main capabilities: batch branchmap - $USUAL_BUNDLE2_CAPS$%0Astream%3Dv2 + $USUAL_BUNDLE2_CAPS$ changegroupsubset compression=zstd,zlib getbundle @@ -136,8 +136,6 @@ remote-changegroup http https - stream - v2 $ hg clone --stream -U http://localhost:$HGPORT server-disabled warning: stream clone requested but server has them disabled