~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/local.py

  • Committer: abentley
  • Date: 2006-04-21 03:34:29 UTC
  • mto: This revision was merged to the branch mainline in revision 1683.
  • Revision ID: abentley@lappy-20060421033429-79932e50ab316980
Strip trailing slashes in a platform-sensible way

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
    def relpath(self, abspath):
69
69
        """Return the local path portion from a given absolute path.
70
70
        """
71
 
        from bzrlib.osutils import relpath
 
71
        from bzrlib.osutils import relpath, strip_trailing_slash
72
72
        if abspath is None:
73
73
            abspath = u'.'
74
 
        if len(abspath) > 1 and abspath.endswith('/'):
75
 
            abspath = abspath[:-1]
76
 
        if self.base == '/':
77
 
            root = '/'
78
 
        else:
79
 
            root = self.base[:-1]
80
 
        return relpath(root, abspath)
 
74
 
 
75
        return relpath(strip_trailing_slash(self.base), 
 
76
                       strip_trailing_slash(abspath))
81
77
 
82
78
    def has(self, relpath):
83
79
        return os.access(self.abspath(relpath), os.F_OK)