~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-09-01 08:02:42 UTC
  • mfrom: (5390.3.3 faster-revert-593560)
  • Revision ID: pqm@pqm.ubuntu.com-20100901080242-esg62ody4frwmy66
(spiv) Avoid repeatedly calling self.target.all_file_ids() in
 InterTree.iter_changes. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1182
1182
            if trans_id not in self._new_contents:
1183
1183
                continue
1184
1184
            new_path = self._limbo_name(trans_id)
1185
 
            osutils.rename(old_path, new_path)
 
1185
            os.rename(old_path, new_path)
1186
1186
            for descendant in self._limbo_descendants(trans_id):
1187
1187
                desc_path = self._limbo_files[descendant]
1188
1188
                desc_path = new_path + desc_path[len(old_path):]
2919
2919
    def rename(self, from_, to):
2920
2920
        """Rename a file from one path to another."""
2921
2921
        try:
2922
 
            osutils.rename(from_, to)
2923
 
        except (IOError, OSError), e:
 
2922
            os.rename(from_, to)
 
2923
        except OSError, e:
2924
2924
            if e.errno in (errno.EEXIST, errno.ENOTEMPTY):
2925
2925
                raise errors.FileExists(to, str(e))
2926
2926
            # normal OSError doesn't include filenames so it's hard to see where
2942
2942
        """Reverse all renames that have been performed"""
2943
2943
        for from_, to in reversed(self.past_renames):
2944
2944
            try:
2945
 
                osutils.rename(to, from_)
2946
 
            except (OSError, IOError), e:
 
2945
                os.rename(to, from_)
 
2946
            except OSError, e:
2947
2947
                raise errors.TransformRenameFailed(to, from_, str(e), e.errno)                
2948
2948
        # after rollback, don't reuse _FileMover
2949
2949
        past_renames = None