Mercurial > public > mercurial-scm > hg
comparison mercurial/wireproto.py @ 35783:c97639ad6874
bundle2: specify what capabilities will be used for
We currently assume there is a symmetric relationship of bundle2
capabilities between client and server. However, this may not always be
the case.
We need a bundle2 capability to advertise bundle2 streaming clone support
on servers to differentiate it from the existing, legacy streaming clone
support.
However, servers may wish to disable streaming clone support. If bundle2
capabilities were the same between client and server, a client (which
may also be a server) that has disabled streaming clone support would
not be able to perform a streaming clone itself!
This commit introduces a "role" argument to bundle2.getrepocaps() that
explicitly defines the role being performed. This will allow us (and
extensions) to alter bundle2 capabilities depending on the operation
being performed.
Differential Revision: https://phab.mercurial-scm.org/D1923
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 20 Jan 2018 13:54:36 -0800 |
parents | 9d249f3de730 |
children | ba15580e53d5 |
comparison
equal
deleted
inserted
replaced
35782:9d249f3de730 | 35783:c97639ad6874 |
---|---|
778 caps.append('stream') | 778 caps.append('stream') |
779 # otherwise, add 'streamreqs' detailing our local revlog format | 779 # otherwise, add 'streamreqs' detailing our local revlog format |
780 else: | 780 else: |
781 caps.append('streamreqs=%s' % ','.join(sorted(requiredformats))) | 781 caps.append('streamreqs=%s' % ','.join(sorted(requiredformats))) |
782 if repo.ui.configbool('experimental', 'bundle2-advertise'): | 782 if repo.ui.configbool('experimental', 'bundle2-advertise'): |
783 capsblob = bundle2.encodecaps(bundle2.getrepocaps(repo)) | 783 capsblob = bundle2.encodecaps(bundle2.getrepocaps(repo, role='server')) |
784 caps.append('bundle2=' + urlreq.quote(capsblob)) | 784 caps.append('bundle2=' + urlreq.quote(capsblob)) |
785 caps.append('unbundle=%s' % ','.join(bundle2.bundlepriority)) | 785 caps.append('unbundle=%s' % ','.join(bundle2.bundlepriority)) |
786 | 786 |
787 if proto.name == 'http': | 787 if proto.name == 'http': |
788 caps.append('httpheader=%d' % | 788 caps.append('httpheader=%d' % |