comparison mercurial/bundle2.py @ 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 b116a66bcc44
children 1d118f9f4f57
comparison
equal deleted inserted replaced
35789:8ed5f7609728 35790:c1b9eb15a51c
1517 cpmode = repo.ui.config('server', 'concurrent-push-mode') 1517 cpmode = repo.ui.config('server', 'concurrent-push-mode')
1518 if cpmode == 'check-related': 1518 if cpmode == 'check-related':
1519 caps['checkheads'] = ('related',) 1519 caps['checkheads'] = ('related',)
1520 if 'phases' in repo.ui.configlist('devel', 'legacy.exchange'): 1520 if 'phases' in repo.ui.configlist('devel', 'legacy.exchange'):
1521 caps.pop('phases') 1521 caps.pop('phases')
1522 if not repo.ui.configbool('experimental', 'bundle2.stream'): 1522
1523 caps.pop('stream') 1523 # Don't advertise stream clone support in server mode if not configured.
1524 if role == 'server':
1525 streamsupported = repo.ui.configbool('server', 'uncompressed',
1526 untrusted=True)
1527 featuresupported = repo.ui.configbool('experimental', 'bundle2.stream')
1528
1529 if not streamsupported or not featuresupported:
1530 caps.pop('stream')
1531 # role == 'client'
1532 else:
1533 if not repo.ui.configbool('experimental', 'bundle2.stream'):
1534 caps.pop('stream')
1535
1524 return caps 1536 return caps
1525 1537
1526 def bundle2caps(remote): 1538 def bundle2caps(remote):
1527 """return the bundle capabilities of a peer as dict""" 1539 """return the bundle capabilities of a peer as dict"""
1528 raw = remote.capable('bundle2') 1540 raw = remote.capable('bundle2')