705
705
def _parent_type_conflicts(self, by_parent):
706
"""parents must have directory 'contents'."""
706
"""Children must have a directory parent"""
708
708
for parent_id, children in by_parent.iteritems():
709
709
if parent_id is ROOT_PARENT:
711
if not self._any_contents(children):
712
for child_id in children:
713
if self.final_kind(child_id) is not None:
718
# There is at least a child, so we need an existing directory to
713
720
kind = self.final_kind(parent_id)
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))
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:
727
729
def _set_executability(self, path, trans_id):
728
730
"""Set the executability of versioned files """
729
731
if supports_executable():
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
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
830
elif self.final_file_id(child_tid) is None:
831
# The child is not versioned
832
orphans.append(child_tid)
827
834
# We have a versioned file here, searching for orphans is