~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: 2006-09-15 01:31:27 UTC
  • mfrom: (1910.15.11 extra transport tests)
  • Revision ID: pqm@pqm.ubuntu.com-20060915013127-9c6755fb4c48456e
(Andrew Bennetts, Robert Collins, Martin Pool) Ensure consistent behaviour at the root of transports for clone/abspath.

Show diffs side-by-side

added added

removed removed

Lines of Context:
198
198
        """Return the path to be passed along the sftp protocol for relpath.
199
199
        
200
200
        relpath is a urlencoded string.
 
201
 
 
202
        :return: a path prefixed with / for regular abspath-based urls, or a
 
203
            path that does not begin with / for urls which begin with /~/.
201
204
        """
202
205
        # FIXME: share the common code across transports
203
206
        assert isinstance(relpath, basestring)
 
207
        basepath = self._path.split('/')
 
208
        if relpath.startswith('/'):
 
209
            basepath = ['', '']
204
210
        relpath = urlutils.unescape(relpath).split('/')
205
 
        basepath = self._path.split('/')
206
211
        if len(basepath) > 0 and basepath[-1] == '':
207
212
            basepath = basepath[:-1]
208
213
 
215
220
                basepath.pop()
216
221
            elif p == '.':
217
222
                continue # No-op
218
 
            else:
 
223
            elif p != '':
219
224
                basepath.append(p)
220
225
 
221
226
        path = '/'.join(basepath)
688
693
        return SFTPLock(relpath, self)
689
694
 
690
695
    def _unparse_url(self, path=None):
 
696
        """Gives a url for a relative reference."""
691
697
        if path is None:
692
698
            path = self._path
693
699
        path = urllib.quote(path)