~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/remote.py

  • Committer: Jelmer Vernooij
  • Date: 2011-12-05 14:12:23 UTC
  • mto: This revision was merged to the branch mainline in revision 6348.
  • Revision ID: jelmer@samba.org-20111205141223-8qxae4h37satlzgq
Move more functionality to vf_search.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Canonical Ltd
 
1
# Copyright (C) 2006-2010 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
170
170
 
171
171
    def _remote_path(self, relpath):
172
172
        """Returns the Unicode version of the absolute path for relpath."""
173
 
        return self._combine_paths(self._path, relpath)
 
173
        return urlutils.URL._combine_paths(self._parsed_url.path, relpath)
174
174
 
175
175
    def _call(self, method, *args):
176
176
        resp = self._call2(method, *args)
435
435
        remote._translate_error(err, path=relpath)
436
436
 
437
437
    def disconnect(self):
438
 
        self.get_smart_medium().disconnect()
 
438
        m = self.get_smart_medium()
 
439
        if m is not None:
 
440
            m.disconnect()
439
441
 
440
442
    def stat(self, relpath):
441
443
        resp = self._call2('stat', self._remote_path(relpath))
481
483
 
482
484
    def _build_medium(self):
483
485
        client_medium = medium.SmartTCPClientMedium(
484
 
            self._host, self._port, self.base)
 
486
            self._parsed_url.host, self._parsed_url.port, self.base)
485
487
        return client_medium, None
486
488
 
487
489
 
494
496
 
495
497
    def _build_medium(self):
496
498
        client_medium = medium.SmartTCPClientMedium(
497
 
            self._host, self._port, self.base)
 
499
            self._parsed_url.host, self._parsed_url.port, self.base)
498
500
        client_medium._protocol_version = 2
499
501
        client_medium._remember_remote_is_before((1, 6))
500
502
        return client_medium, None
510
512
    def _build_medium(self):
511
513
        location_config = config.LocationConfig(self.base)
512
514
        bzr_remote_path = location_config.get_bzr_remote_path()
513
 
        user = self._user
 
515
        user = self._parsed_url.user
514
516
        if user is None:
515
517
            auth = config.AuthenticationConfig()
516
 
            user = auth.get_user('ssh', self._host, self._port)
517
 
        client_medium = medium.SmartSSHClientMedium(self._host, self._port,
518
 
            user, self._password, self.base,
519
 
            bzr_remote_path=bzr_remote_path)
520
 
        return client_medium, (user, self._password)
 
518
            user = auth.get_user('ssh', self._parsed_url.host,
 
519
                self._parsed_url.port)
 
520
        ssh_params = medium.SSHParams(self._parsed_url.host,
 
521
                self._parsed_url.port, user, self._parsed_url.password,
 
522
                bzr_remote_path)
 
523
        client_medium = medium.SmartSSHClientMedium(self.base, ssh_params)
 
524
        return client_medium, (user, self._parsed_url.password)
521
525
 
522
526
 
523
527
class RemoteHTTPTransport(RemoteTransport):
537
541
            # url only for an intial construction (when the url came from the
538
542
            # command-line).
539
543
            http_url = base[len('bzr+'):]
540
 
            self._http_transport = transport.get_transport(http_url)
 
544
            self._http_transport = transport.get_transport_from_url(http_url)
541
545
        else:
542
546
            self._http_transport = http_transport
543
547
        super(RemoteHTTPTransport, self).__init__(