/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/transport/remote.py

Move bzrlib/transport/smart/_smart.py to bzrlib/transport/remote.py and rename SmartTransport to RemoteTransport (Robert Collins, Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
"""SmartTransport client for the smart-server.
 
17
"""RemoteTransport client for the smart-server.
18
18
 
19
19
This module shouldn't be accessed directly.  The classes defined here should be
20
20
imported from bzrlib.transport.smart.
21
21
"""
22
22
 
23
 
__all__ = ['SmartTransport', 'SmartTCPTransport', 'SmartSSHTransport']
 
23
__all__ = ['RemoteTransport', 'SmartTCPTransport', 'SmartSSHTransport']
24
24
 
25
25
from cStringIO import StringIO
26
26
import urllib
45
45
        self.st_mode = mode
46
46
 
47
47
 
48
 
class SmartTransport(transport.Transport):
 
48
class RemoteTransport(transport.Transport):
49
49
    """Connection to a smart server.
50
50
 
51
51
    The connection holds references to the medium that can be used to send
62
62
    SmartTCPTransport, etc.
63
63
    """
64
64
 
65
 
    # IMPORTANT FOR IMPLEMENTORS: SmartTransport MUST NOT be given encoding
 
65
    # IMPORTANT FOR IMPLEMENTORS: RemoteTransport MUST NOT be given encoding
66
66
    # responsibilities: Put those on SmartClient or similar. This is vital for
67
67
    # the ability to support multiple versions of the smart protocol over time:
68
 
    # SmartTransport is an adapter from the Transport object model to the 
 
68
    # RemoteTransport is an adapter from the Transport object model to the 
69
69
    # SmartClient model, not an encoder.
70
70
 
71
71
    def __init__(self, url, clone_from=None, medium=None):
79
79
        ### initialisation order things would blow up. 
80
80
        if not url.endswith('/'):
81
81
            url += '/'
82
 
        super(SmartTransport, self).__init__(url)
 
82
        super(RemoteTransport, self).__init__(url)
83
83
        self._scheme, self._username, self._password, self._host, self._port, self._path = \
84
84
                transport.split_url(url)
85
85
        if clone_from is None:
101
101
        return self._unparse_url(self._remote_path(relpath))
102
102
    
103
103
    def clone(self, relative_url):
104
 
        """Make a new SmartTransport related to me, sharing the same connection.
 
104
        """Make a new RemoteTransport related to me, sharing the same connection.
105
105
 
106
106
        This essentially opens a handle on a different remote directory.
107
107
        """
108
108
        if relative_url is None:
109
 
            return SmartTransport(self.base, self)
 
109
            return RemoteTransport(self.base, self)
110
110
        else:
111
 
            return SmartTransport(self.abspath(relative_url), self)
 
111
            return RemoteTransport(self.abspath(relative_url), self)
112
112
 
113
113
    def is_readonly(self):
114
114
        """Smart server transport can do read/write file operations."""
405
405
            self._translate_error(resp)
406
406
 
407
407
 
408
 
class SmartTCPTransport(SmartTransport):
 
408
class SmartTCPTransport(RemoteTransport):
409
409
    """Connection to smart server over plain tcp.
410
410
    
411
411
    This is essentially just a factory to get 'RemoteTransport(url,
423
423
        super(SmartTCPTransport, self).__init__(url, medium=client_medium)
424
424
 
425
425
 
426
 
class SmartSSHTransport(SmartTransport):
 
426
class SmartSSHTransport(RemoteTransport):
427
427
    """Connection to smart server over SSH.
428
428
 
429
429
    This is essentially just a factory to get 'RemoteTransport(url,
444
444
        super(SmartSSHTransport, self).__init__(url, medium=client_medium)
445
445
 
446
446
 
 
447
def get_test_permutations():
 
448
    """Return (transport, server) permutations for testing."""
 
449
    ### We may need a little more test framework support to construct an
 
450
    ### appropriate RemoteTransport in the future.
 
451
    from bzrlib.transport.smart import server
 
452
    return [(SmartTCPTransport, server.SmartTCPServer_for_testing)]