87
87
include_root=include_root
90
def _iter_changes(self, from_tree, include_unchanged=False,
90
def _iter_changes(self, from_tree, include_unchanged=False,
91
91
specific_file_ids=None, pb=None):
92
92
intertree = InterTree.get(from_tree, self)
93
return intertree._iter_changes(from_tree, self, include_unchanged,
93
return intertree._iter_changes(include_unchanged,
94
94
specific_file_ids, pb)
96
96
def conflicts(self):
596
596
return delta._compare_trees(self.source, self.target, want_unchanged,
597
597
specific_file_ids, include_root)
599
def _iter_changes(self, from_tree, to_tree, include_unchanged,
600
specific_file_ids, pb):
599
def _iter_changes(self, include_unchanged=False,
600
specific_file_ids=None, pb=None):
601
601
"""Generate an iterator of changes between trees.
603
603
A tuple is returned:
604
604
(file_id, path, changed_content, versioned, parent, name, kind,
607
Path is relative to the to_tree. changed_content is True if the file's
608
content has changed. This includes changes to its kind, and to
607
Path is relative to the target tree. changed_content is True if the
608
file's content has changed. This includes changes to its kind, and to
609
609
a symlink's target.
611
611
versioned, parent, name, kind, executable are tuples of (from, to).
612
612
If a file is missing in a tree, its kind is None.
614
Iteration is done in parent-to-child order, relative to the to_tree.
614
Iteration is done in parent-to-child order, relative to the target
617
from_entries_by_dir = list(from_tree.inventory.iter_entries_by_dir(
618
from_entries_by_dir = list(self.source.inventory.iter_entries_by_dir(
618
619
specific_file_ids=specific_file_ids))
619
620
from_data = dict((e.file_id, (p, e)) for p, e in from_entries_by_dir)
620
to_entries_by_dir = list(to_tree.inventory.iter_entries_by_dir(
621
to_entries_by_dir = list(self.target.inventory.iter_entries_by_dir(
621
622
specific_file_ids=specific_file_ids))
622
623
num_entries = len(from_entries_by_dir) + len(to_entries_by_dir)
633
634
from_name = from_entry.name
634
635
from_parent = from_entry.parent_id
635
636
from_kind, from_executable, from_stat = \
636
from_tree._comparison_data(from_entry, from_path)
637
self.source._comparison_data(from_entry, from_path)
639
640
from_versioned = False
643
644
from_executable = None
644
645
versioned = (from_versioned, True)
645
646
to_kind, to_executable, to_stat = \
646
to_tree._comparison_data(to_entry, to_path)
647
self.target._comparison_data(to_entry, to_path)
647
648
kind = (from_kind, to_kind)
648
649
if kind[0] != kind[1]:
649
650
changed_content = True
650
651
elif from_kind == 'file':
651
from_size = from_tree._file_size(from_entry, from_stat)
652
to_size = to_tree._file_size(to_entry, to_stat)
652
from_size = self.source._file_size(from_entry, from_stat)
653
to_size = self.target._file_size(to_entry, to_stat)
653
654
if from_size != to_size:
654
655
changed_content = True
655
elif (from_tree.get_file_sha1(file_id, from_path, from_stat) !=
656
to_tree.get_file_sha1(file_id, to_path, to_stat)):
656
elif (self.source.get_file_sha1(file_id, from_path, from_stat) !=
657
self.target.get_file_sha1(file_id, to_path, to_stat)):
657
658
changed_content = True
658
659
elif from_kind == 'symlink':
659
if (from_tree.get_symlink_target(file_id) !=
660
to_tree.get_symlink_target(file_id)):
660
if (self.source.get_symlink_target(file_id) !=
661
self.target.get_symlink_target(file_id)):
661
662
changed_content = True
662
663
elif from_kind == 'tree-reference':
663
if (from_tree.get_reference_revision(from_entry, from_path) !=
664
to_tree.get_reference_revision(to_entry, to_path)):
664
if (self.source.get_reference_revision(from_entry, from_path)
665
!= self.target.get_reference_revision(to_entry, to_path)):
665
666
changed_content = True
666
667
parent = (from_parent, to_entry.parent_id)
667
668
name = (from_name, to_entry.name)
681
682
if from_entry.parent_id not in to_paths:
682
get_to_path(from_tree.inventory[from_entry.parent_id])
683
get_to_path(self.source.inventory[from_entry.parent_id])
683
684
to_path = osutils.pathjoin(to_paths[from_entry.parent_id],
685
686
to_paths[from_entry.file_id] = to_path
697
698
parent = (from_entry.parent_id, None)
698
699
name = (from_entry.name, None)
699
700
from_kind, from_executable, stat_value = \
700
from_tree._comparison_data(from_entry, path)
701
self.source._comparison_data(from_entry, path)
701
702
kind = (from_kind, None)
702
703
executable = (from_executable, None)
703
704
changed_content = True