mercurial/sshpeer.py
changeset 37393 afcfdf53e4b5
parent 37321 e826fe7a08c7
child 37411 3e1688711efd
equal deleted inserted replaced
37392:a4f02a17420d 37393:afcfdf53e4b5
   160     # feel free to remove buffering and select usage when we ultimately
   160     # feel free to remove buffering and select usage when we ultimately
   161     # move to threading.
   161     # move to threading.
   162     stdin, stdout, stderr, proc = procutil.popen4(cmd, bufsize=0, env=sshenv)
   162     stdin, stdout, stderr, proc = procutil.popen4(cmd, bufsize=0, env=sshenv)
   163 
   163 
   164     return proc, stdin, stdout, stderr
   164     return proc, stdin, stdout, stderr
       
   165 
       
   166 def _clientcapabilities():
       
   167     """Return list of capabilities of this client.
       
   168 
       
   169     Returns a list of capabilities that are supported by this client.
       
   170     """
       
   171     protoparams = []
       
   172     comps = [e.wireprotosupport().name for e in
       
   173              util.compengines.supportedwireengines(util.CLIENTROLE)]
       
   174     protoparams.append('comp=%s' % ','.join(comps))
       
   175     return protoparams
   165 
   176 
   166 def _performhandshake(ui, stdin, stdout, stderr):
   177 def _performhandshake(ui, stdin, stdout, stderr):
   167     def badresponse():
   178     def badresponse():
   168         # Flush any output on stderr.
   179         # Flush any output on stderr.
   169         _forwardoutput(ui, stderr)
   180         _forwardoutput(ui, stderr)
   607             raise error.RepoError(_('could not create remote repo'))
   618             raise error.RepoError(_('could not create remote repo'))
   608 
   619 
   609     proc, stdin, stdout, stderr = _makeconnection(ui, sshcmd, args, remotecmd,
   620     proc, stdin, stdout, stderr = _makeconnection(ui, sshcmd, args, remotecmd,
   610                                                   remotepath, sshenv)
   621                                                   remotepath, sshenv)
   611 
   622 
   612     return makepeer(ui, path, proc, stdin, stdout, stderr)
   623     peer = makepeer(ui, path, proc, stdin, stdout, stderr)
       
   624 
       
   625     # Finally, if supported by the server, notify it about our own
       
   626     # capabilities.
       
   627     if 'protocaps' in peer.capabilities():
       
   628         try:
       
   629             peer._call("protocaps", caps=' '.join(_clientcapabilities()))
       
   630         except IOError:
       
   631             peer._cleanup()
       
   632             raise error.RepoError(_('capability exchange failed'))
       
   633 
       
   634     return peer