~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/__init__.py

  • Committer: Vincent Ladeuil
  • Date: 2007-06-06 14:26:08 UTC
  • mto: (2485.8.44 bzr.connection.sharing)
  • mto: This revision was merged to the branch mainline in revision 2646.
  • Revision ID: v.ladeuil+lp@free.fr-20070606142608-i9ufaqewadslf1cn
Finish sftp refactoring. Test suite passing.

* bzrlib/transport/sftp.py:
(clear_connection_cache): Deprecated.
(_sftp_connect, _sftp_connect_uncached): Deleted.
(SFTPTransport.__init__): Simplified.
(SFTPTransport._create_connection): New method. Copied from
_sftp_connect_uncached
(SFTPTransport._get_sftp): New method. Ensures that the connection
is established.
(SFTPTransport.clone): Deleted.
(SFTPTransport.has, SFTPTransport.get, SFTPTransport.readv,
SFTPTransport._put,
SFTPTransport._put_non_atomic_helper._open_and_write_file,
SFTPTransport._mkdir, SFTPTransport.append_file,
SFTPTransport.rename, SFTPTransport._rename_and_overwrite,
SFTPTransport.delete, SFTPTransport.rmdir, SFTPTransport.stat):
Use _get_sftp.

* bzrlib/tests/test_transport_implementations.py:
(TransportTests.test_connection_error): Simplified now that sftp
does not connection on construction.

* bzrlib/tests/test_sftp_transport.py:
(SFTPLockTests.test_sftp_locks): Delete test_multiple_connections.
(FakeSFTPTransport): Deleted.
(SFTPNonServerTest.test_parse_url_with_home_dir,
SFTPNonServerTest.test_relpath,
SSHVendorBadConnection.test_bad_connection_paramiko): Delete the
from_transport parameter as it's not needed anymore.
(SFTPLatencyKnob.test_latency_knob_slows_transport,
SFTPLatencyKnob.test_default): Force connection by issuing a
request.

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
    2) register the protocol provider with the function
111
111
    register_transport_provider( ) ( and the "lazy" variant )
112
112
 
113
 
    This in needed because:
 
113
    This is needed because:
114
114
    a) a single provider can support multple protcol ( like the ftp
115
 
    privider which supports both the ftp:// and the aftp:// protocols )
 
115
    provider which supports both the ftp:// and the aftp:// protocols )
116
116
    b) a single protocol can have multiple providers ( like the http://
117
 
    protocol which is supported by both the urllib and pycurl privider )
 
117
    protocol which is supported by both the urllib and pycurl provider )
118
118
    """
119
119
 
120
120
    def register_transport_provider(self, key, obj):
1310
1310
        if m:
1311
1311
            # This looks like a URL, but we weren't able to 
1312
1312
            # instantiate it as such raise an appropriate error
 
1313
            # FIXME: we have a 'error_str' unused and we use last_err below
1313
1314
            raise errors.UnsupportedProtocol(base, last_err)
1314
1315
        # This doesn't look like a protocol, consider it a local path
1315
1316
        new_base = urlutils.local_path_to_url(base)