~jelmer/brz/zsh-completion

« back to all changes in this revision

Viewing changes to bzrlib/transport/__init__.py

  • Committer: Robert Collins
  • Date: 2010-04-08 04:34:03 UTC
  • mfrom: (5138 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5139.
  • Revision ID: robertc@robertcollins.net-20100408043403-56z0d07vdqrx7f3t
Update bugfix for 528114 to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1060
1060
        """
1061
1061
        source = self.clone(from_relpath)
1062
1062
        target = self.clone(to_relpath)
1063
 
        target.mkdir('.')
 
1063
 
 
1064
        # create target directory with the same rwx bits as source.
 
1065
        # use mask to ensure that bits other than rwx are ignored.
 
1066
        stat = self.stat(from_relpath)
 
1067
        target.mkdir('.', stat.st_mode & 0777)
 
1068
 
1064
1069
        source.copy_tree_to_transport(target)
1065
1070
 
1066
1071
    def copy_tree_to_transport(self, to_transport):
1202
1207
        count = self._iterate_over(relpaths, gather, pb, 'stat', expand=False)
1203
1208
        return stats
1204
1209
 
 
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)
 
1213
 
 
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)
 
1217
 
 
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)
 
1221
 
1205
1222
    def listable(self):
1206
1223
        """Return True if this store supports listing."""
1207
1224
        raise NotImplementedError(self.listable)
1663
1680
class Server(object):
1664
1681
    """A Transport Server.
1665
1682
 
1666
 
    The Server interface provides a server for a given transport. We use
1667
 
    these servers as loopback testing tools. For any given transport the
1668
 
    Servers it provides must either allow writing, or serve the contents
1669
 
    of os.getcwdu() at the time start_server is called.
1670
 
 
1671
 
    Note that these are real servers - they must implement all the things
1672
 
    that we want bzr transports to take advantage of.
 
1683
    The Server interface provides a server for a given transport type.
1673
1684
    """
1674
1685
 
1675
1686
    def start_server(self):
1678
1689
    def stop_server(self):
1679
1690
        """Remove the server and cleanup any resources it owns."""
1680
1691
 
1681
 
    def get_url(self):
1682
 
        """Return a url for this server.
1683
 
 
1684
 
        If the transport does not represent a disk directory (i.e. it is
1685
 
        a database like svn, or a memory only transport, it should return
1686
 
        a connection to a newly established resource for this Server.
1687
 
        Otherwise it should return a url that will provide access to the path
1688
 
        that was os.getcwdu() when start_server() was called.
1689
 
 
1690
 
        Subsequent calls will return the same resource.
1691
 
        """
1692
 
        raise NotImplementedError
1693
 
 
1694
 
    def get_bogus_url(self):
1695
 
        """Return a url for this protocol, that will fail to connect.
1696
 
 
1697
 
        This may raise NotImplementedError to indicate that this server cannot
1698
 
        provide bogus urls.
1699
 
        """
1700
 
        raise NotImplementedError
1701
 
 
1702
1692
 
1703
1693
# None is the default transport, for things with no url scheme
1704
1694
register_transport_proto('file://',
1858
1848
 
1859
1849
 
1860
1850
transport_server_registry = registry.Registry()
1861
 
transport_server_registry.register_lazy('bzr', 'bzrlib.smart.server', 
 
1851
transport_server_registry.register_lazy('bzr', 'bzrlib.smart.server',
1862
1852
    'serve_bzr', help="The Bazaar smart server protocol over TCP. (default port: 4155)")
1863
1853
transport_server_registry.default_key = 'bzr'