~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/remote.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-03-17 07:05:37 UTC
  • mfrom: (4152.1.2 branch.stacked.streams)
  • Revision ID: pqm@pqm.ubuntu.com-20090317070537-zaud24vjs2szna87
(robertc) Add client-side streaming from stacked branches (over
        bzr:// protocols) when the sort order is compatible with doing
        that. (Robert Collins, Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
"""RemoteTransport client for the smart-server.
18
18
 
34
34
    urlutils,
35
35
    )
36
36
from bzrlib.smart import client, medium
37
 
from bzrlib.symbol_versioning import (
38
 
    deprecated_method,
39
 
    )
 
37
from bzrlib.symbol_versioning import (deprecated_method, one_four)
40
38
 
41
39
 
42
40
class _SmartStat(object):
168
166
    def get_smart_medium(self):
169
167
        return self._get_connection()
170
168
 
 
169
    @deprecated_method(one_four)
 
170
    def get_shared_medium(self):
 
171
        return self._get_shared_connection()
 
172
 
171
173
    def _remote_path(self, relpath):
172
174
        """Returns the Unicode version of the absolute path for relpath."""
173
175
        return self._combine_paths(self._path, relpath)
435
437
        remote._translate_error(err, path=relpath)
436
438
 
437
439
    def disconnect(self):
438
 
        m = self.get_smart_medium()
439
 
        if m is not None:
440
 
            m.disconnect()
 
440
        self.get_smart_medium().disconnect()
441
441
 
442
442
    def stat(self, relpath):
443
443
        resp = self._call2('stat', self._remote_path(relpath))
516
516
        if user is None:
517
517
            auth = config.AuthenticationConfig()
518
518
            user = auth.get_user('ssh', self._host, self._port)
519
 
        ssh_params = medium.SSHParams(self._host, self._port, user,
520
 
            self._password, bzr_remote_path)
521
 
        client_medium = medium.SmartSSHClientMedium(self.base, ssh_params)
 
519
        client_medium = medium.SmartSSHClientMedium(self._host, self._port,
 
520
            user, self._password, self.base,
 
521
            bzr_remote_path=bzr_remote_path)
522
522
        return client_medium, (user, self._password)
523
523
 
524
524
 
603
603
    """Return (transport, server) permutations for testing."""
604
604
    ### We may need a little more test framework support to construct an
605
605
    ### appropriate RemoteTransport in the future.
606
 
    from bzrlib.tests import test_server
607
 
    return [(RemoteTCPTransport, test_server.SmartTCPServer_for_testing)]
 
606
    from bzrlib.smart import server
 
607
    return [(RemoteTCPTransport, server.SmartTCPServer_for_testing)]