88
90
modules.add(factory._module_name)
90
92
modules.add(factory._obj.__module__)
91
# Add chroot and pathfilter directly, because there is no handler
93
# Add chroot directly, because there is no handler registered for it.
93
94
modules.add('bzrlib.transport.chroot')
94
modules.add('bzrlib.transport.pathfilter')
95
95
result = list(modules)
1062
1059
source = self.clone(from_relpath)
1063
1060
target = self.clone(to_relpath)
1065
# create target directory with the same rwx bits as source.
1066
# use mask to ensure that bits other than rwx are ignored.
1067
stat = self.stat(from_relpath)
1068
target.mkdir('.', stat.st_mode & 0777)
1069
1062
source.copy_tree_to_transport(target)
1071
1064
def copy_tree_to_transport(self, to_transport):
1207
1200
count = self._iterate_over(relpaths, gather, pb, 'stat', expand=False)
1210
def readlink(self, relpath):
1211
"""Return a string representing the path to which the symbolic link points."""
1212
raise errors.TransportNotPossible("Dereferencing symlinks is not supported on %s" % self)
1214
def hardlink(self, source, link_name):
1215
"""Create a hardlink pointing to source named link_name."""
1216
raise errors.TransportNotPossible("Hard links are not supported on %s" % self)
1218
def symlink(self, source, link_name):
1219
"""Create a symlink pointing to source named link_name."""
1220
raise errors.TransportNotPossible("Symlinks are not supported on %s" % self)
1222
1203
def listable(self):
1223
1204
"""Return True if this store supports listing."""
1224
1205
raise NotImplementedError(self.listable)
1286
1267
# should be asked to ConnectedTransport only.
1289
def disconnect(self):
1290
# This is really needed for ConnectedTransport only, but it's easier to
1291
# have Transport do nothing than testing that the disconnect should be
1292
# asked to ConnectedTransport only.
1295
1270
def _redirected_to(self, source, target):
1296
1271
"""Returns a transport suitable to re-issue a redirected request.
1556
1531
transport = self.__class__(other_base, _from_transport=self)
1557
1532
return transport
1559
def disconnect(self):
1560
"""Disconnect the transport.
1562
If and when required the transport willl reconnect automatically.
1564
raise NotImplementedError(self.disconnect)
1535
# We try to recognize an url lazily (ignoring user, password, etc)
1536
_urlRE = re.compile(r'^(?P<proto>[^:/\\]+)://(?P<rest>.*)$')
1567
1538
def get_transport(base, possible_transports=None):
1568
1539
"""Open a transport to access a URL or directory.
1689
1661
class Server(object):
1690
1662
"""A Transport Server.
1692
The Server interface provides a server for a given transport type.
1664
The Server interface provides a server for a given transport. We use
1665
these servers as loopback testing tools. For any given transport the
1666
Servers it provides must either allow writing, or serve the contents
1667
of os.getcwdu() at the time setUp is called.
1669
Note that these are real servers - they must implement all the things
1670
that we want bzr transports to take advantage of.
1695
def start_server(self):
1696
1674
"""Setup the server to service requests."""
1698
def stop_server(self):
1699
1677
"""Remove the server and cleanup any resources it owns."""
1680
"""Return a url for this server.
1682
If the transport does not represent a disk directory (i.e. it is
1683
a database like svn, or a memory only transport, it should return
1684
a connection to a newly established resource for this Server.
1685
Otherwise it should return a url that will provide access to the path
1686
that was os.getcwdu() when setUp() was called.
1688
Subsequent calls will return the same resource.
1690
raise NotImplementedError
1692
def get_bogus_url(self):
1693
"""Return a url for this protocol, that will fail to connect.
1695
This may raise NotImplementedError to indicate that this server cannot
1698
raise NotImplementedError
1702
1701
# None is the default transport, for things with no url scheme
1703
1702
register_transport_proto('file://',
1749
1748
register_lazy_transport('ftp://', 'bzrlib.transport.ftp', 'FtpTransport')
1750
1749
register_transport_proto('aftp://', help="Access using active FTP.")
1751
1750
register_lazy_transport('aftp://', 'bzrlib.transport.ftp', 'FtpTransport')
1752
register_transport_proto('gio+', help="Access using any GIO supported protocols.")
1753
register_lazy_transport('gio+', 'bzrlib.transport.gio_transport', 'GioTransport')
1756
# Default to trying GSSAPI authentication (if the kerberos module is
1758
register_transport_proto('ftp+gssapi://', register_netloc=True)
1759
register_transport_proto('aftp+gssapi://', register_netloc=True)
1760
register_transport_proto('ftp+nogssapi://', register_netloc=True)
1761
register_transport_proto('aftp+nogssapi://', register_netloc=True)
1762
register_lazy_transport('ftp+gssapi://', 'bzrlib.transport.ftp._gssapi',
1763
'GSSAPIFtpTransport')
1764
register_lazy_transport('aftp+gssapi://', 'bzrlib.transport.ftp._gssapi',
1765
'GSSAPIFtpTransport')
1766
register_lazy_transport('ftp://', 'bzrlib.transport.ftp._gssapi',
1767
'GSSAPIFtpTransport')
1768
register_lazy_transport('aftp://', 'bzrlib.transport.ftp._gssapi',
1769
'GSSAPIFtpTransport')
1770
register_lazy_transport('ftp+nogssapi://', 'bzrlib.transport.ftp',
1772
register_lazy_transport('aftp+nogssapi://', 'bzrlib.transport.ftp',
1754
kerberos_available = True
1756
kerberos_available = False
1758
if kerberos_available:
1759
# Default to trying GSSAPI authentication (if the kerberos module is
1761
register_transport_proto('ftp+gssapi://', register_netloc=True)
1762
register_lazy_transport('ftp+gssapi://', 'bzrlib.transport.ftp._gssapi',
1763
'GSSAPIFtpTransport')
1764
register_transport_proto('aftp+gssapi://', register_netloc=True)
1765
register_lazy_transport('aftp+gssapi://', 'bzrlib.transport.ftp._gssapi',
1766
'GSSAPIFtpTransport')
1767
register_transport_proto('ftp+nogssapi://', register_netloc=True)
1768
register_transport_proto('aftp+nogssapi://', register_netloc=True)
1770
register_lazy_transport('ftp://', 'bzrlib.transport.ftp._gssapi',
1771
'GSSAPIFtpTransport')
1772
register_lazy_transport('aftp://', 'bzrlib.transport.ftp._gssapi',
1773
'GSSAPIFtpTransport')
1774
register_lazy_transport('ftp+nogssapi://', 'bzrlib.transport.ftp',
1776
register_lazy_transport('aftp+nogssapi://', 'bzrlib.transport.ftp',
1775
1779
register_transport_proto('memory://')
1776
1780
register_lazy_transport('memory://', 'bzrlib.transport.memory',
1854
1858
transport_server_registry = registry.Registry()
1855
transport_server_registry.register_lazy('bzr', 'bzrlib.smart.server',
1859
transport_server_registry.register_lazy('bzr', 'bzrlib.smart.server',
1856
1860
'serve_bzr', help="The Bazaar smart server protocol over TCP. (default port: 4155)")
1857
1861
transport_server_registry.default_key = 'bzr'