~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/local.py

  • Committer: Martin Pool
  • Date: 2010-04-21 11:27:04 UTC
  • mto: This revision was merged to the branch mainline in revision 5189.
  • Revision ID: mbp@canonical.com-20100421112704-zijso22b6pdevrxy
Simplify various code to use user_url

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
         - relative_reference is url escaped.
100
100
        """
101
101
        if relative_reference in ('.', ''):
102
 
            # _local_base normally has a trailing slash; strip it so that stat
103
 
            # on a transport pointing to a symlink reads the link not the
104
 
            # referent but be careful of / and c:\
105
 
            return osutils.split(self._local_base)[0]
 
102
            return self._local_base
106
103
        return self._local_base + urlutils.unescape(relative_reference)
107
104
 
108
105
    def abspath(self, relpath):
402
399
 
403
400
    def rename(self, rel_from, rel_to):
404
401
        path_from = self._abspath(rel_from)
405
 
        path_to = self._abspath(rel_to)
406
402
        try:
407
403
            # *don't* call bzrlib.osutils.rename, because we want to
408
 
            # detect conflicting names on rename, and osutils.rename tries to
409
 
            # mask cross-platform differences there
410
 
            os.rename(path_from, path_to)
 
404
            # detect errors on rename
 
405
            os.rename(path_from, self._abspath(rel_to))
411
406
        except (IOError, OSError),e:
412
407
            # TODO: What about path_to?
413
408
            self._translate_error(e, path_from)