~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-09 16:48:55 UTC
  • mto: (6437.23.24 2.5)
  • mto: This revision was merged to the branch mainline in revision 6499.
  • Revision ID: v.ladeuil+lp@free.fr-20120309164855-htdn25hp7x65mmir
Rely on sphinx for texinfo doc generation

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