~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/remote.py

  • Committer: Patch Queue Manager
  • Date: 2015-09-30 16:43:21 UTC
  • mfrom: (6603.2.2 fix-keep-dirty)
  • Revision ID: pqm@pqm.ubuntu.com-20150930164321-ct2v2qnmvimqt8qf
(vila) Avoid associating dirty patch headers with the previous file in the
 patch. (Colin Watson)

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
34
36
    urlutils,
35
37
    )
36
38
from bzrlib.smart import client, medium
37
 
from bzrlib.symbol_versioning import (
38
 
    deprecated_method,
39
 
    )
40
39
 
41
40
 
42
41
class _SmartStat(object):
170
169
 
171
170
    def _remote_path(self, relpath):
172
171
        """Returns the Unicode version of the absolute path for relpath."""
173
 
        return self._combine_paths(self._path, relpath)
 
172
        return urlutils.URL._combine_paths(self._parsed_url.path, relpath)
174
173
 
175
174
    def _call(self, method, *args):
176
175
        resp = self._call2(method, *args)
435
434
        remote._translate_error(err, path=relpath)
436
435
 
437
436
    def disconnect(self):
438
 
        self.get_smart_medium().disconnect()
 
437
        m = self.get_smart_medium()
 
438
        if m is not None:
 
439
            m.disconnect()
439
440
 
440
441
    def stat(self, relpath):
441
442
        resp = self._call2('stat', self._remote_path(relpath))
481
482
 
482
483
    def _build_medium(self):
483
484
        client_medium = medium.SmartTCPClientMedium(
484
 
            self._host, self._port, self.base)
 
485
            self._parsed_url.host, self._parsed_url.port, self.base)
485
486
        return client_medium, None
486
487
 
487
488
 
494
495
 
495
496
    def _build_medium(self):
496
497
        client_medium = medium.SmartTCPClientMedium(
497
 
            self._host, self._port, self.base)
 
498
            self._parsed_url.host, self._parsed_url.port, self.base)
498
499
        client_medium._protocol_version = 2
499
500
        client_medium._remember_remote_is_before((1, 6))
500
501
        return client_medium, None
510
511
    def _build_medium(self):
511
512
        location_config = config.LocationConfig(self.base)
512
513
        bzr_remote_path = location_config.get_bzr_remote_path()
513
 
        user = self._user
 
514
        user = self._parsed_url.user
514
515
        if user is None:
515
516
            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)
 
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)
 
522
        client_medium = medium.SmartSSHClientMedium(self.base, ssh_params)
 
523
        return client_medium, (user, self._parsed_url.password)
521
524
 
522
525
 
523
526
class RemoteHTTPTransport(RemoteTransport):
537
540
            # url only for an intial construction (when the url came from the
538
541
            # command-line).
539
542
            http_url = base[len('bzr+'):]
540
 
            self._http_transport = transport.get_transport(http_url)
 
543
            self._http_transport = transport.get_transport_from_url(http_url)
541
544
        else:
542
545
            self._http_transport = http_transport
543
546
        super(RemoteHTTPTransport, self).__init__(