~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-12 01:42:55 UTC
  • mfrom: (6055.2.12 unparsedurl)
  • Revision ID: pqm@pqm.ubuntu.com-20110812014255-y3thbw6gdn7cw6uz
(jelmer) Add a URL object for manipulating parsed URLs. (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
    )
343
336
        :param relpath: is a urlencoded string.
344
337
        """
345
338
        relative = urlutils.unescape(relpath).encode('utf-8')
346
 
        remote_path = self._combine_paths(self._path, relative)
 
339
        remote_path = self._combine_paths(self._parsed_url.path, relative)
347
340
        # the initial slash should be removed from the path, and treated as a
348
341
        # homedir relative path (the path begins with a double slash if it is
349
342
        # absolute).  see draft-ietf-secsh-scp-sftp-ssh-uri-03.txt
368
361
        in base url at transport creation time.
369
362
        """
370
363
        if credentials is None:
371
 
            password = self._password
 
364
            password = self._parsed_url.password
372
365
        else:
373
366
            password = credentials
374
367
 
375
368
        vendor = ssh._get_ssh_vendor()
376
 
        user = self._user
 
369
        user = self._parsed_url.user
377
370
        if user is None:
378
371
            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)
 
372
            user = auth.get_user('ssh', self._parsed_url.host,
 
373
                self._parsed_url.port)
 
374
        connection = vendor.connect_sftp(self._parsed_url.user, password,
 
375
            self._parsed_url.host, self._parsed_url.port)
382
376
        return connection, (user, password)
383
377
 
384
378
    def disconnect(self):