~bzr-pqm/bzr/bzr.dev

Viewing all changes in revision 2485.8.54.

  • Committer: Vincent Ladeuil
  • Date: 2007-07-14 13:55:20 UTC
  • mto: This revision was merged to the branch mainline in revision 2646.
  • Revision ID: v.ladeuil+lp@free.fr-20070714135520-y2310bi8fzclx410
Refactor medium uses by making a distinction betweem shared and real medium.

* bzrlib/transport/remote.py:
(RemoteTransport.__init__): Rework the medium building.
(RemoteTransport.get_shared_medium): Give access to the shared
connection.
(RemoteTransport.get_bytes, RemoteTransport.readv,
RemoteTransport.disconnect): Use the real medium.
(RemoteTCPTransport._build_medium): Simplified.
(RemoteSSHTransport._build_medium): Simplified.
(RemoteHTTPTransport): Simplified.

* bzrlib/transport/__init__.py:
(Transport.get_shared_medium): Mimick get_smart_medium but
provides access to the shared medium.
(ConnectedTransport.__init__): Rename connection_sharing to
shared_connection as it bettre fits the use by smart stransports.
(ConnectedTransport._set_shared_connection,
ConnectedTransport._get_shared_connection): New accessors.
(ConnectedTransport._set_connection,
ConnectedTransport._get_connection,
ConnectedTransport._get_credentials,
ConnectedTransport._update_credentials): Use the new accessors.

* bzrlib/tests/test_transport_implementations.py:
(TransportTests.test_connection_sharing): Adapt the test as smart
transports have a connection even before the first request.

* bzrlib/tests/test_smart_transport.py:
(WritableEndToEndTests.test_simple_clone_conn): Use the real medium.

* bzrlib/smart/client.py:
(_SmartClient): Build from a shared medium.
(_SmartClient.get_smart_medium): Provides access to the real
medium.
(_SmartClient.call_expecting_body,
_SmartClient.call_with_body_bytes): Use the real medium.

* bzrlib/remote.py:
(RemoteBzrDir.__init__, RemoteRepository.__init__,
RemoteBranch.__init__): Use the shared medium to build the smart
client.

* bzrlib/bzrdir.py:
(RemoteBzrDirFormat.initialize_on_transport): Use the shared
medium to build the smart client.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: