/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: James Westby
  • Date: 2008-07-31 17:22:38 UTC
  • mto: This revision was merged to the branch mainline in revision 3609.
  • Revision ID: jw+debian@jameswestby.net-20080731172238-ba5br3gjk2mjkarb
Handle ->symlink changes as well.

Show diffs side-by-side

added added

removed removed

Lines of Context:
384
384
            os.unlink(name)
385
385
            raise
386
386
 
 
387
    def _does_tree_kind_match(self, trans_id, kind):
 
388
        """Checks whether the kind of trans_id has changed from the tree.
 
389
 
 
390
        Returns True if trans_id exists in the tree and matches the
 
391
        kind passed. Returns False otherwise.
 
392
        """
 
393
        try:
 
394
            if self.tree_kind(trans_id) == 'directory':
 
395
                return True
 
396
        except NoSuchFile:
 
397
            pass
 
398
        return False
 
399
 
387
400
    def create_directory(self, trans_id):
388
401
        """Schedule creation of a new directory.
389
402
        
390
403
        See also new_directory.
391
404
        """
392
 
        try:
393
 
            if self.tree_kind(trans_id) != 'directory':
394
 
                self._kind_change.add(trans_id)
395
 
        except NoSuchFile:
396
 
            pass
 
405
        if not self._does_tree_kind_match(trans_id, 'directory'):
 
406
            self._kind_change.add(trans_id)
397
407
        os.mkdir(self._limbo_name(trans_id))
398
408
        unique_add(self._new_contents, trans_id, 'directory')
399
409
 
403
413
        target is a bytestring.
404
414
        See also new_symlink.
405
415
        """
 
416
        if not self._does_tree_kind_match(trans_id, 'symlink'):
 
417
            self._kind_change.add(trans_id)
406
418
        if has_symlinks():
407
419
            os.symlink(target, self._limbo_name(trans_id))
408
420
            unique_add(self._new_contents, trans_id, 'symlink')