~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Aaron Bentley
  • Date: 2006-04-19 01:23:36 UTC
  • mfrom: (1669 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1673.
  • Revision ID: aaron.bentley@utoronto.ca-20060419012336-a74d3d2ea435d15f
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
                           ReusingTransform, NotVersionedError, CantMoveRoot,
23
23
                           ExistingLimbo, ImmortalLimbo)
24
24
from bzrlib.inventory import InventoryEntry
25
 
from bzrlib.osutils import file_kind, supports_executable, pathjoin, lexists
 
25
from bzrlib.osutils import (file_kind, supports_executable, pathjoin, lexists,
 
26
                            delete_any)
26
27
from bzrlib.progress import DummyProgress, ProgressPhase
27
28
from bzrlib.trace import mutter, warning
28
29
import bzrlib.ui 
286
287
        os.symlink(target, self._limbo_name(trans_id))
287
288
        unique_add(self._new_contents, trans_id, 'symlink')
288
289
 
289
 
    @staticmethod
290
 
    def delete_any(full_path):
291
 
        """Delete a file or directory."""
292
 
        try:
293
 
            os.unlink(full_path)
294
 
        except OSError, e:
295
 
        # We may be renaming a dangling inventory id
296
 
            if e.errno not in (errno.EISDIR, errno.EACCES, errno.EPERM):
297
 
                raise
298
 
            os.rmdir(full_path)
299
 
 
300
290
    def cancel_creation(self, trans_id):
301
291
        """Cancel the creation of new file contents."""
302
292
        del self._new_contents[trans_id]
303
 
        self.delete_any(self._limbo_name(trans_id))
 
293
        delete_any(self._limbo_name(trans_id))
304
294
 
305
295
    def delete_contents(self, trans_id):
306
296
        """Schedule the contents of a path entry for deletion"""
730
720
                child_pb.update('removing file', num, len(tree_paths))
731
721
                full_path = self._tree.abspath(path)
732
722
                if trans_id in self._removed_contents:
733
 
                    self.delete_any(full_path)
 
723
                    delete_any(full_path)
734
724
                elif trans_id in self._new_name or trans_id in \
735
725
                    self._new_parent:
736
726
                    try: