~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/local.py

  • Committer: John Arbash Meinel
  • Date: 2006-04-26 20:52:37 UTC
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: john@arbash-meinel.com-20060426205237-36d969d421bcb429
Some more work to get LocalTransport to only support URLs

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
        if base[-1] != '/':
50
50
            base = base + '/'
51
51
        super(LocalTransport, self).__init__(base)
52
 
        # mutter('LocalTransport(%s)', base)
 
52
        self._local_base = local_path_from_url(base)
53
53
 
54
54
    def should_cache(self):
55
55
        return False
67
67
    def abspath(self, relpath):
68
68
        """Return the full url to the given relative URL."""
69
69
        assert isinstance(relpath, basestring), (type(relpath), relpath)
70
 
        result = pathjoin(self.base, urlunescape(relpath))
71
 
        assert result.startswith('file://')
72
 
        return 'file://' + normpath(result[len('file://'):])
 
70
        # jam 20060426 Using normpath on the real path, because that ensures
 
71
        #       proper handling of stuff like
 
72
        path = normpath(pathjoin(self._local_base, urlunescape(relpath)))
 
73
        return local_path_to_url(path)
73
74
 
74
75
    def local_abspath(self, relpath):
75
76
        """Transform the given relative path URL into the actual path on disk
86
87
    def relpath(self, abspath):
87
88
        """Return the local path portion from a given absolute path.
88
89
        """
89
 
        from bzrlib.osutils import urlrelpath, strip_trailing_slash
 
90
        from bzrlib.osutils import urlrelpath, strip_url_trailing_slash
90
91
        if abspath is None:
91
92
            abspath = u'.'
92
93
 
93
 
        return urlrelpath(strip_trailing_slash(self.base), 
94
 
                       strip_trailing_slash(abspath))
 
94
        return urlrelpath(strip_url_trailing_slash(self.base), 
 
95
                       strip_url_trailing_slash(abspath))
95
96
 
96
97
    def has(self, relpath):
97
98
        return os.access(self.local_abspath(relpath), os.F_OK)
340
341
 
341
342
    def get_url(self):
342
343
        """See Transport.Server.get_url."""
343
 
        # FIXME: \ to / on windows
344
344
        return local_path_to_url('')
345
345
 
346
346