~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/remote.py

  • Committer: Vincent Ladeuil
  • Date: 2012-03-13 17:25:29 UTC
  • mfrom: (6499 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6501.
  • Revision ID: v.ladeuil+lp@free.fr-20120313172529-i0suyjnepsor25i7
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
imported from bzrlib.smart.
21
21
"""
22
22
 
 
23
from __future__ import absolute_import
 
24
 
23
25
__all__ = ['RemoteTransport', 'RemoteTCPTransport', 'RemoteSSHTransport']
24
26
 
25
27
from cStringIO import StringIO
167
169
 
168
170
    def _remote_path(self, relpath):
169
171
        """Returns the Unicode version of the absolute path for relpath."""
170
 
        return self._combine_paths(self._path, relpath)
 
172
        return urlutils.URL._combine_paths(self._parsed_url.path, relpath)
171
173
 
172
174
    def _call(self, method, *args):
173
175
        resp = self._call2(method, *args)
480
482
 
481
483
    def _build_medium(self):
482
484
        client_medium = medium.SmartTCPClientMedium(
483
 
            self._host, self._port, self.base)
 
485
            self._parsed_url.host, self._parsed_url.port, self.base)
484
486
        return client_medium, None
485
487
 
486
488
 
493
495
 
494
496
    def _build_medium(self):
495
497
        client_medium = medium.SmartTCPClientMedium(
496
 
            self._host, self._port, self.base)
 
498
            self._parsed_url.host, self._parsed_url.port, self.base)
497
499
        client_medium._protocol_version = 2
498
500
        client_medium._remember_remote_is_before((1, 6))
499
501
        return client_medium, None
509
511
    def _build_medium(self):
510
512
        location_config = config.LocationConfig(self.base)
511
513
        bzr_remote_path = location_config.get_bzr_remote_path()
512
 
        user = self._user
 
514
        user = self._parsed_url.user
513
515
        if user is None:
514
516
            auth = config.AuthenticationConfig()
515
 
            user = auth.get_user('ssh', self._host, self._port)
516
 
        ssh_params = medium.SSHParams(self._host, self._port, user,
517
 
            self._password, bzr_remote_path)
 
517
            user = auth.get_user('ssh', self._parsed_url.host,
 
518
                self._parsed_url.port)
 
519
        ssh_params = medium.SSHParams(self._parsed_url.host,
 
520
                self._parsed_url.port, user, self._parsed_url.password,
 
521
                bzr_remote_path)
518
522
        client_medium = medium.SmartSSHClientMedium(self.base, ssh_params)
519
 
        return client_medium, (user, self._password)
 
523
        return client_medium, (user, self._parsed_url.password)
520
524
 
521
525
 
522
526
class RemoteHTTPTransport(RemoteTransport):
536
540
            # url only for an intial construction (when the url came from the
537
541
            # command-line).
538
542
            http_url = base[len('bzr+'):]
539
 
            self._http_transport = transport.get_transport(http_url)
 
543
            self._http_transport = transport.get_transport_from_url(http_url)
540
544
        else:
541
545
            self._http_transport = http_transport
542
546
        super(RemoteHTTPTransport, self).__init__(