~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: 2006-04-12 03:21:39 UTC
  • mfrom: (1558.12.7 revert-missing)
  • Revision ID: pqm@pqm.ubuntu.com-20060412032139-5508773d6a1cd4ae
Remove debug path printing

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,
26
 
                            delete_any)
 
25
from bzrlib.osutils import file_kind, supports_executable, pathjoin, lexists
27
26
from bzrlib.progress import DummyProgress, ProgressPhase
28
27
from bzrlib.trace import mutter, warning
29
28
import bzrlib.ui 
287
286
        os.symlink(target, self._limbo_name(trans_id))
288
287
        unique_add(self._new_contents, trans_id, 'symlink')
289
288
 
 
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
 
290
300
    def cancel_creation(self, trans_id):
291
301
        """Cancel the creation of new file contents."""
292
302
        del self._new_contents[trans_id]
293
 
        delete_any(self._limbo_name(trans_id))
 
303
        self.delete_any(self._limbo_name(trans_id))
294
304
 
295
305
    def delete_contents(self, trans_id):
296
306
        """Schedule the contents of a path entry for deletion"""
720
730
                child_pb.update('removing file', num, len(tree_paths))
721
731
                full_path = self._tree.abspath(path)
722
732
                if trans_id in self._removed_contents:
723
 
                    delete_any(full_path)
 
733
                    self.delete_any(full_path)
724
734
                elif trans_id in self._new_name or trans_id in \
725
735
                    self._new_parent:
726
736
                    try: