mercurial/sshpeer.py
changeset 39549 089fc0db0954
parent 38713 27391d74aaa2
child 43076 2372284d9457
equal deleted inserted replaced
39548:7ce9dea3a14a 39549:089fc0db0954
   595     else:
   595     else:
   596         _cleanuppipes(ui, stdout, stdin, stderr)
   596         _cleanuppipes(ui, stdout, stdin, stderr)
   597         raise error.RepoError(_('unknown version of SSH protocol: %s') %
   597         raise error.RepoError(_('unknown version of SSH protocol: %s') %
   598                               protoname)
   598                               protoname)
   599 
   599 
   600 def instance(ui, path, create, intents=None):
   600 def instance(ui, path, create, intents=None, createopts=None):
   601     """Create an SSH peer.
   601     """Create an SSH peer.
   602 
   602 
   603     The returned object conforms to the ``wireprotov1peer.wirepeer`` interface.
   603     The returned object conforms to the ``wireprotov1peer.wirepeer`` interface.
   604     """
   604     """
   605     u = util.url(path, parsequery=False, parsefragment=False)
   605     u = util.url(path, parsequery=False, parsefragment=False)
   618     remotepath = u.path or '.'
   618     remotepath = u.path or '.'
   619 
   619 
   620     args = procutil.sshargs(sshcmd, u.host, u.user, u.port)
   620     args = procutil.sshargs(sshcmd, u.host, u.user, u.port)
   621 
   621 
   622     if create:
   622     if create:
       
   623         # We /could/ do this, but only if the remote init command knows how to
       
   624         # handle them. We don't yet make any assumptions about that. And without
       
   625         # querying the remote, there's no way of knowing if the remote even
       
   626         # supports said requested feature.
       
   627         if createopts:
       
   628             raise error.RepoError(_('cannot create remote SSH repositories '
       
   629                                     'with extra options'))
       
   630 
   623         cmd = '%s %s %s' % (sshcmd, args,
   631         cmd = '%s %s %s' % (sshcmd, args,
   624             procutil.shellquote('%s init %s' %
   632             procutil.shellquote('%s init %s' %
   625                 (_serverquote(remotecmd), _serverquote(remotepath))))
   633                 (_serverquote(remotecmd), _serverquote(remotepath))))
   626         ui.debug('running %s\n' % cmd)
   634         ui.debug('running %s\n' % cmd)
   627         res = ui.system(cmd, blockedtag='sshpeer', environ=sshenv)
   635         res = ui.system(cmd, blockedtag='sshpeer', environ=sshenv)