~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Aaron Bentley
  • Date: 2010-05-10 11:34:20 UTC
  • mfrom: (5218 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5221.
  • Revision ID: aaron@aaronbentley.com-20100510113420-toh2d5yioobb5uq1
Merged bzr.dev into transform-commit-full.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
    )
37
37
""")
38
38
from bzrlib.errors import (DuplicateKey, MalformedTransform, NoSuchFile,
39
 
                           ReusingTransform, NotVersionedError, CantMoveRoot,
 
39
                           ReusingTransform, CantMoveRoot,
40
40
                           ExistingLimbo, ImmortalLimbo, NoFinalPath,
41
41
                           UnableCreateSymlink)
42
42
from bzrlib.filters import filtered_output_bytes, ContentFilterContext
1181
1181
            if trans_id not in self._new_contents:
1182
1182
                continue
1183
1183
            new_path = self._limbo_name(trans_id)
1184
 
            os.rename(old_path, new_path)
 
1184
            osutils.rename(old_path, new_path)
1185
1185
            for descendant in self._limbo_descendants(trans_id):
1186
1186
                desc_path = self._limbo_files[descendant]
1187
1187
                desc_path = new_path + desc_path[len(old_path):]
2919
2919
        self.pending_deletions = []
2920
2920
 
2921
2921
    def rename(self, from_, to):
2922
 
        """Rename a file from one path to another.  Functions like os.rename"""
 
2922
        """Rename a file from one path to another."""
2923
2923
        try:
2924
 
            os.rename(from_, to)
 
2924
            osutils.rename(from_, to)
2925
2925
        except OSError, e:
2926
2926
            if e.errno in (errno.EEXIST, errno.ENOTEMPTY):
2927
2927
                raise errors.FileExists(to, str(e))
2941
2941
    def rollback(self):
2942
2942
        """Reverse all renames that have been performed"""
2943
2943
        for from_, to in reversed(self.past_renames):
2944
 
            os.rename(to, from_)
 
2944
            osutils.rename(to, from_)
2945
2945
        # after rollback, don't reuse _FileMover
2946
2946
        past_renames = None
2947
2947
        pending_deletions = None