Mercurial > hg
comparison mercurial/sshpeer.py @ 37411:3e1688711efd
wireproto: turn client capabilities into sets, sorted on the wire
Differential Revision: https://phab.mercurial-scm.org/D3169
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Fri, 06 Apr 2018 21:50:01 +0200 |
parents | afcfdf53e4b5 |
children | aacfca6f9767 |
comparison
equal
deleted
inserted
replaced
37410:a6651f5e2c78 | 37411:3e1688711efd |
---|---|
166 def _clientcapabilities(): | 166 def _clientcapabilities(): |
167 """Return list of capabilities of this client. | 167 """Return list of capabilities of this client. |
168 | 168 |
169 Returns a list of capabilities that are supported by this client. | 169 Returns a list of capabilities that are supported by this client. |
170 """ | 170 """ |
171 protoparams = [] | 171 protoparams = set() |
172 comps = [e.wireprotosupport().name for e in | 172 comps = [e.wireprotosupport().name for e in |
173 util.compengines.supportedwireengines(util.CLIENTROLE)] | 173 util.compengines.supportedwireengines(util.CLIENTROLE)] |
174 protoparams.append('comp=%s' % ','.join(comps)) | 174 protoparams.add('comp=%s' % ','.join(comps)) |
175 return protoparams | 175 return protoparams |
176 | 176 |
177 def _performhandshake(ui, stdin, stdout, stderr): | 177 def _performhandshake(ui, stdin, stdout, stderr): |
178 def badresponse(): | 178 def badresponse(): |
179 # Flush any output on stderr. | 179 # Flush any output on stderr. |
624 | 624 |
625 # Finally, if supported by the server, notify it about our own | 625 # Finally, if supported by the server, notify it about our own |
626 # capabilities. | 626 # capabilities. |
627 if 'protocaps' in peer.capabilities(): | 627 if 'protocaps' in peer.capabilities(): |
628 try: | 628 try: |
629 peer._call("protocaps", caps=' '.join(_clientcapabilities())) | 629 peer._call("protocaps", |
630 caps=' '.join(sorted(_clientcapabilities()))) | |
630 except IOError: | 631 except IOError: |
631 peer._cleanup() | 632 peer._cleanup() |
632 raise error.RepoError(_('capability exchange failed')) | 633 raise error.RepoError(_('capability exchange failed')) |
633 | 634 |
634 return peer | 635 return peer |