~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/remote.py

  • Committer: Martin Pool
  • Date: 2010-02-25 06:17:27 UTC
  • mfrom: (5055 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5057.
  • Revision ID: mbp@sourcefrog.net-20100225061727-4sd9lt0qmdc6087t
merge news

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