554
554
def __init__(self):
555
self._homedir = os.getcwd()
555
self._homedir = urlutils.local_path_to_url(os.getcwd())[7:]
556
556
# The server is set up by default like for ssh access: the client
557
557
# passes filesystem-absolute paths; therefore the server must look
558
558
# them up relative to the root directory. it might be better to act
559
559
# a public server and have the server rewrite paths into the test
561
SmartTCPServer.__init__(self, transport.get_transport("file:///"))
561
SmartTCPServer.__init__(self,
562
transport.get_transport(urlutils.local_path_to_url('/')))
564
565
"""Set up server for testing"""
1029
1027
if self._socket is not None:
1030
1028
self._socket.close()
1033
from bzrlib.transport import sftp, ssh
1034
except errors.ParamikoNotPresent:
1035
# no paramiko, no SSHTransport.
1038
class SmartSSHTransport(SmartTransport):
1039
"""Connection to smart server over SSH."""
1041
def __init__(self, url, clone_from=None):
1042
# TODO: all this probably belongs in the parent class.
1043
super(SmartSSHTransport, self).__init__(url, clone_from)
1045
if self._port is not None:
1046
self._port = int(self._port)
1047
except (ValueError, TypeError), e:
1048
raise errors.InvalidURL(path=url, extra="invalid port %s" % self._port)
1050
def _connect_to_server(self):
1051
executable = os.environ.get('BZR_REMOTE_PATH', 'bzr')
1052
vendor = ssh._get_ssh_vendor()
1053
self._ssh_connection = vendor.connect_ssh(self._username,
1054
self._password, self._host, self._port,
1055
command=[executable, 'serve', '--inet', '--directory=/',
1057
return self._ssh_connection.get_filelike_channels()
1059
def disconnect(self):
1060
super(SmartSSHTransport, self).disconnect()
1061
self._ssh_connection.close()
1031
class SmartSSHTransport(SmartTransport):
1032
"""Connection to smart server over SSH."""
1034
def __init__(self, url, clone_from=None):
1035
# TODO: all this probably belongs in the parent class.
1036
super(SmartSSHTransport, self).__init__(url, clone_from)
1038
if self._port is not None:
1039
self._port = int(self._port)
1040
except (ValueError, TypeError), e:
1041
raise errors.InvalidURL(path=url, extra="invalid port %s" % self._port)
1043
def _connect_to_server(self):
1044
from bzrlib.transport import ssh
1045
executable = os.environ.get('BZR_REMOTE_PATH', 'bzr')
1046
vendor = ssh._get_ssh_vendor()
1047
self._ssh_connection = vendor.connect_ssh(self._username,
1048
self._password, self._host, self._port,
1049
command=[executable, 'serve', '--inet', '--directory=/',
1051
return self._ssh_connection.get_filelike_channels()
1053
def disconnect(self):
1054
super(SmartSSHTransport, self).disconnect()
1055
self._ssh_connection.close()
1064
1058
def get_test_permutations():