214
213
from bzrlib.bundle.serializer import write_bundle
215
from bzrlib.transport import ssh
216
except errors.ParamikoNotPresent:
217
# no paramiko. SmartSSHClientMedium will break.
216
220
# must do this otherwise urllib can't parse the urls properly :(
217
221
for scheme in ['ssh', 'bzr', 'bzr+loopback', 'bzr+ssh']:
886
890
def __init__(self):
887
self._homedir = os.getcwd()
891
self._homedir = urlutils.local_path_to_url(os.getcwd())[7:]
888
892
# The server is set up by default like for ssh access: the client
889
893
# passes filesystem-absolute paths; therefore the server must look
890
894
# them up relative to the root directory. it might be better to act
891
895
# a public server and have the server rewrite paths into the test
893
SmartTCPServer.__init__(self, transport.get_transport("file:///"))
897
SmartTCPServer.__init__(self,
898
transport.get_transport(urlutils.local_path_to_url('/')))
896
901
"""Set up server for testing"""
902
907
def get_url(self):
903
908
"""Return the url of the server"""
904
909
host, port = self._server_socket.getsockname()
905
# XXX: I think this is likely to break on windows -- self._homedir will
906
# have backslashes (and maybe a drive letter?).
907
# -- Andrew Bennetts, 2006-08-29
908
910
return "bzr://%s:%d%s" % (host, port, urlutils.escape(self._homedir))
910
912
def get_bogus_url(self):
1743
1745
super(SmartTCPTransport, self).__init__(url, medium=medium)
1747
from bzrlib.transport import ssh
1748
except errors.ParamikoNotPresent:
1749
# no paramiko, no SSHTransport.
1752
class SmartSSHTransport(SmartTransport):
1753
"""Connection to smart server over SSH.
1755
This is essentially just a factory to get 'RemoteTransport(url,
1756
SmartSSHClientMedium).
1759
def __init__(self, url):
1760
_scheme, _username, _password, _host, _port, _path = \
1761
transport.split_url(url)
1763
if _port is not None:
1765
except (ValueError, TypeError), e:
1766
raise errors.InvalidURL(path=url, extra="invalid port %s" %
1768
medium = SmartSSHClientMedium(_host, _port, _username, _password)
1769
super(SmartSSHTransport, self).__init__(url, medium=medium)
1748
class SmartSSHTransport(SmartTransport):
1749
"""Connection to smart server over SSH.
1751
This is essentially just a factory to get 'RemoteTransport(url,
1752
SmartSSHClientMedium).
1755
def __init__(self, url):
1756
_scheme, _username, _password, _host, _port, _path = \
1757
transport.split_url(url)
1759
if _port is not None:
1761
except (ValueError, TypeError), e:
1762
raise errors.InvalidURL(path=url, extra="invalid port %s" %
1764
medium = SmartSSHClientMedium(_host, _port, _username, _password)
1765
super(SmartSSHTransport, self).__init__(url, medium=medium)
1772
1768
def get_test_permutations():