57
58
supports_executable,
59
60
from bzrlib.progress import ProgressPhase
60
61
from bzrlib.symbol_versioning import (
65
from bzrlib.trace import mutter, warning
66
from bzrlib import tree
66
from bzrlib.trace import warning
68
68
import bzrlib.urlutils as urlutils
666
666
if (self._new_name, self._new_parent) == ({}, {}):
668
668
for children in by_parent.itervalues():
669
name_ids = [(self.final_name(t), t) for t in children]
670
if not self._case_sensitive_target:
671
name_ids = [(n.lower(), t) for n, t in name_ids]
670
for child_tid in children:
671
name = self.final_name(child_tid)
673
# Keep children only if they still exist in the end
674
if not self._case_sensitive_target:
676
name_ids.append((name, child_tid))
674
679
last_trans_id = None
700
705
def _parent_type_conflicts(self, by_parent):
701
"""parents must have directory 'contents'."""
706
"""Children must have a directory parent"""
703
708
for parent_id, children in by_parent.iteritems():
704
709
if parent_id is ROOT_PARENT:
706
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
708
720
kind = self.final_kind(parent_id)
722
# The directory will be deleted
710
723
conflicts.append(('missing parent', parent_id))
711
724
elif kind != "directory":
725
# Meh, we need a *directory* to put something in it
712
726
conflicts.append(('non-directory parent', parent_id))
715
def _any_contents(self, trans_ids):
716
"""Return true if any of the trans_ids, will have contents."""
717
for trans_id in trans_ids:
718
if self.final_kind(trans_id) is not None:
722
729
def _set_executability(self, path, trans_id):
723
730
"""Set the executability of versioned files """
724
731
if supports_executable():
817
824
# Find the potential orphans, stop if one item should be kept
818
for c in self.by_parent()[dir_id]:
819
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)
822
834
# We have a versioned file here, searching for orphans is