~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/local.py

MergeĀ fromĀ mainline

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
            return LocalTransport(self.abspath(offset))
58
58
 
59
59
    def abspath(self, relpath):
60
 
        """Return the full url to the given relative URL.
61
 
        This can be supplied with a string or a list
62
 
        """
 
60
        """Return the full url to the given relative URL."""
63
61
        assert isinstance(relpath, basestring), (type(relpath), relpath)
64
 
        return pathjoin(self.base, urllib.unquote(relpath))
 
62
        result = normpath(pathjoin(self.base, urllib.unquote(relpath)))
 
63
        #if result[-1] != '/':
 
64
        #    result += '/'
 
65
        return result
65
66
 
66
67
    def relpath(self, abspath):
67
68
        """Return the local path portion from a given absolute path.
69
70
        from bzrlib.osutils import relpath
70
71
        if abspath is None:
71
72
            abspath = u'.'
72
 
        if abspath.endswith('/'):
 
73
        if len(abspath) > 1 and abspath.endswith('/'):
73
74
            abspath = abspath[:-1]
74
 
        return relpath(self.base[:-1], abspath)
 
75
        if self.base == '/':
 
76
            root = '/'
 
77
        else:
 
78
            root = self.base[:-1]
 
79
        return relpath(root, abspath)
75
80
 
76
81
    def has(self, relpath):
77
82
        return os.access(self.abspath(relpath), os.F_OK)