705
705
def _parent_type_conflicts(self, by_parent):
706
"""Children must have a directory parent"""
706
"""parents must have directory 'contents'."""
708
708
for parent_id, children in by_parent.iteritems():
709
709
if parent_id is ROOT_PARENT:
712
for child_id in children:
713
if self.final_kind(child_id) is not None:
711
if not self._any_contents(children):
718
# There is at least a child, so we need an existing directory to
720
713
kind = self.final_kind(parent_id)
722
# The directory will be deleted
723
715
conflicts.append(('missing parent', parent_id))
724
716
elif kind != "directory":
725
# Meh, we need a *directory* to put something in it
726
717
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:
729
727
def _set_executability(self, path, trans_id):
730
728
"""Set the executability of versioned files """
731
729
if supports_executable():
824
822
# Find the potential orphans, stop if one item should be kept
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)
823
for c in self.by_parent()[dir_id]:
824
if self.final_file_id(c) is None:
834
827
# We have a versioned file here, searching for orphans is