~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Vincent Ladeuil
  • Date: 2010-11-24 16:01:57 UTC
  • mfrom: (4597.13.7 cleanup)
  • mto: This revision was merged to the branch mainline in revision 5558.
  • Revision ID: v.ladeuil+lp@free.fr-20101124160157-kieuslo7wj9abdmb
Merge cleanup into 638451-malformed

Show diffs side-by-side

added added

removed removed

Lines of Context:
703
703
        return conflicts
704
704
 
705
705
    def _parent_type_conflicts(self, by_parent):
706
 
        """parents must have directory 'contents'."""
 
706
        """Children must have a directory parent"""
707
707
        conflicts = []
708
708
        for parent_id, children in by_parent.iteritems():
709
709
            if parent_id is ROOT_PARENT:
710
710
                continue
711
 
            if not self._any_contents(children):
 
711
            no_children = True
 
712
            for child_id in children:
 
713
                if self.final_kind(child_id) is not None:
 
714
                    no_children = False
 
715
                    break
 
716
            if no_children:
712
717
                continue
 
718
            # There is at least a child, so we need an existing directory to
 
719
            # contain it.
713
720
            kind = self.final_kind(parent_id)
714
721
            if kind is None:
 
722
                # The directory will be deleted
715
723
                conflicts.append(('missing parent', parent_id))
716
724
            elif kind != "directory":
 
725
                # Meh, we need a *directory* to put something in it
717
726
                conflicts.append(('non-directory parent', parent_id))
718
727
        return conflicts
719
728
 
720
 
    def _any_contents(self, trans_ids):
721
 
        """Return true if any of the trans_ids, will have contents."""
722
 
        for trans_id in trans_ids:
723
 
            if self.final_kind(trans_id) is not None:
724
 
                return True
725
 
        return False
726
 
 
727
729
    def _set_executability(self, path, trans_id):
728
730
        """Set the executability of versioned files """
729
731
        if supports_executable():
820
822
        """
821
823
        orphans = []
822
824
        # Find the potential orphans, stop if one item should be kept
823
 
        for c in self.by_parent()[dir_id]:
824
 
            if self.final_file_id(c) is None:
825
 
                orphans.append(c)
 
825
        for child_tid in self.by_parent()[dir_id]:
 
826
            if child_tid in self._removed_contents:
 
827
                # The child is removed as part of the transform. Since it was
 
828
                # versioned before, it's not an orphan
 
829
                continue
 
830
            elif self.final_file_id(child_tid) is None:
 
831
                # The child is not versioned
 
832
                orphans.append(child_tid)
826
833
            else:
827
834
                # We have a versioned file here, searching for orphans is
828
835
                # meaningless.