~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/local.py

(lifeless) Wrap os.rename to get better errors on failure. (Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
399
399
 
400
400
    def rename(self, rel_from, rel_to):
401
401
        path_from = self._abspath(rel_from)
 
402
        path_to = self._abspath(rel_to)
402
403
        try:
403
404
            # *don't* call bzrlib.osutils.rename, because we want to
404
 
            # detect errors on rename
405
 
            os.rename(path_from, self._abspath(rel_to))
 
405
            # detect conflicting names on rename, and osutils.rename tries to
 
406
            # mask cross-platform differences there; however we do update the
 
407
            # exception to include the filenames
 
408
            os.rename(path_from, path_to)
406
409
        except (IOError, OSError),e:
407
410
            # TODO: What about path_to?
408
 
            self._translate_error(e, path_from)
 
411
            self._translate_error(
 
412
                osutils._add_rename_error_details(e, path_from, path_to),
 
413
                path_from)
409
414
 
410
415
    def move(self, rel_from, rel_to):
411
416
        """Move the item at rel_from to the location at rel_to"""