~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/sftp.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-08-17 18:13:57 UTC
  • mfrom: (5268.7.29 transport-segments)
  • Revision ID: pqm@pqm.ubuntu.com-20110817181357-y5q5eth1hk8bl3om
(jelmer) Allow specifying the colocated branch to use in the branch URL,
 and retrieving the branch name using ControlDir._get_selected_branch.
 (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
import stat
32
32
import sys
33
33
import time
34
 
import urllib
35
 
import urlparse
36
34
import warnings
37
35
 
38
36
from bzrlib import (
42
40
    urlutils,
43
41
    )
44
42
from bzrlib.errors import (FileExists,
45
 
                           NoSuchFile, PathNotChild,
 
43
                           NoSuchFile,
46
44
                           TransportError,
47
45
                           LockError,
48
46
                           PathError,
49
47
                           ParamikoNotPresent,
50
48
                           )
51
 
from bzrlib.osutils import pathjoin, fancy_rename, getcwd
52
 
from bzrlib.symbol_versioning import (
53
 
        deprecated_function,
54
 
        )
 
49
from bzrlib.osutils import fancy_rename
55
50
from bzrlib.trace import mutter, warning
56
51
from bzrlib.transport import (
57
52
    FileFileStream,
58
53
    _file_streams,
59
 
    local,
60
 
    Server,
61
54
    ssh,
62
55
    ConnectedTransport,
63
56
    )
342
335
 
343
336
        :param relpath: is a urlencoded string.
344
337
        """
345
 
        relative = urlutils.unescape(relpath).encode('utf-8')
346
 
        remote_path = self._combine_paths(self._path, relative)
 
338
        remote_path = self._parsed_url.clone(relpath).path
347
339
        # the initial slash should be removed from the path, and treated as a
348
340
        # homedir relative path (the path begins with a double slash if it is
349
341
        # absolute).  see draft-ietf-secsh-scp-sftp-ssh-uri-03.txt
368
360
        in base url at transport creation time.
369
361
        """
370
362
        if credentials is None:
371
 
            password = self._password
 
363
            password = self._parsed_url.password
372
364
        else:
373
365
            password = credentials
374
366
 
375
367
        vendor = ssh._get_ssh_vendor()
376
 
        user = self._user
 
368
        user = self._parsed_url.user
377
369
        if user is None:
378
370
            auth = config.AuthenticationConfig()
379
 
            user = auth.get_user('ssh', self._host, self._port)
380
 
        connection = vendor.connect_sftp(self._user, password,
381
 
                                         self._host, self._port)
 
371
            user = auth.get_user('ssh', self._parsed_url.host,
 
372
                self._parsed_url.port)
 
373
        connection = vendor.connect_sftp(self._parsed_url.user, password,
 
374
            self._parsed_url.host, self._parsed_url.port)
382
375
        return connection, (user, password)
383
376
 
384
377
    def disconnect(self):