~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Vincent Ladeuil
  • Date: 2010-04-23 08:51:52 UTC
  • mfrom: (5131.2.6 support_OO_flag)
  • mto: This revision was merged to the branch mainline in revision 5179.
  • Revision ID: v.ladeuil+lp@free.fr-20100423085152-uoewc1vnkwqhw0pj
Manually assign docstrings to command objects, so that they work with python -OO

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    )
36
36
""")
37
37
from bzrlib.errors import (DuplicateKey, MalformedTransform, NoSuchFile,
38
 
                           ReusingTransform, CantMoveRoot,
 
38
                           ReusingTransform, NotVersionedError, CantMoveRoot,
39
39
                           ExistingLimbo, ImmortalLimbo, NoFinalPath,
40
40
                           UnableCreateSymlink)
41
41
from bzrlib.filters import filtered_output_bytes, ContentFilterContext
1160
1160
            if trans_id not in self._new_contents:
1161
1161
                continue
1162
1162
            new_path = self._limbo_name(trans_id)
1163
 
            osutils.rename(old_path, new_path)
 
1163
            os.rename(old_path, new_path)
1164
1164
            for descendant in self._limbo_descendants(trans_id):
1165
1165
                desc_path = self._limbo_files[descendant]
1166
1166
                desc_path = new_path + desc_path[len(old_path):]
2898
2898
        self.pending_deletions = []
2899
2899
 
2900
2900
    def rename(self, from_, to):
2901
 
        """Rename a file from one path to another."""
 
2901
        """Rename a file from one path to another.  Functions like os.rename"""
2902
2902
        try:
2903
 
            osutils.rename(from_, to)
 
2903
            os.rename(from_, to)
2904
2904
        except OSError, e:
2905
2905
            if e.errno in (errno.EEXIST, errno.ENOTEMPTY):
2906
2906
                raise errors.FileExists(to, str(e))
2920
2920
    def rollback(self):
2921
2921
        """Reverse all renames that have been performed"""
2922
2922
        for from_, to in reversed(self.past_renames):
2923
 
            osutils.rename(to, from_)
 
2923
            os.rename(to, from_)
2924
2924
        # after rollback, don't reuse _FileMover
2925
2925
        past_renames = None
2926
2926
        pending_deletions = None