~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/sftp.py

(gz) Never raise KnownFailure in tests,
 use knownFailure method instead (Martin [gz])

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