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):
587
587
return delta._compare_trees(self.source, self.target, want_unchanged,
588
588
specific_file_ids, include_root)
590
def _iter_changes(self, from_tree, to_tree, include_unchanged,
591
specific_file_ids, pb):
590
def _iter_changes(self, include_unchanged=False,
591
specific_file_ids=None, pb=None):
592
592
"""Generate an iterator of changes between trees.
594
594
A tuple is returned:
595
595
(file_id, path, changed_content, versioned, parent, name, kind,
598
Path is relative to the to_tree. changed_content is True if the file's
599
content has changed. This includes changes to its kind, and to
598
Path is relative to the target tree. changed_content is True if the
599
file's content has changed. This includes changes to its kind, and to
600
600
a symlink's target.
602
602
versioned, parent, name, kind, executable are tuples of (from, to).
603
603
If a file is missing in a tree, its kind is None.
605
Iteration is done in parent-to-child order, relative to the to_tree.
605
Iteration is done in parent-to-child order, relative to the target
608
from_entries_by_dir = list(from_tree.inventory.iter_entries_by_dir(
609
from_entries_by_dir = list(self.source.inventory.iter_entries_by_dir(
609
610
specific_file_ids=specific_file_ids))
610
611
from_data = dict((e.file_id, (p, e)) for p, e in from_entries_by_dir)
611
to_entries_by_dir = list(to_tree.inventory.iter_entries_by_dir(
612
to_entries_by_dir = list(self.target.inventory.iter_entries_by_dir(
612
613
specific_file_ids=specific_file_ids))
613
614
num_entries = len(from_entries_by_dir) + len(to_entries_by_dir)
624
625
from_name = from_entry.name
625
626
from_parent = from_entry.parent_id
626
627
from_kind, from_executable, from_stat = \
627
from_tree._comparison_data(from_entry, from_path)
628
self.source._comparison_data(from_entry, from_path)
630
631
from_versioned = False
634
635
from_executable = None
635
636
versioned = (from_versioned, True)
636
637
to_kind, to_executable, to_stat = \
637
to_tree._comparison_data(to_entry, to_path)
638
self.target._comparison_data(to_entry, to_path)
638
639
kind = (from_kind, to_kind)
639
640
if kind[0] != kind[1]:
640
641
changed_content = True
641
642
elif from_kind == 'file':
642
from_size = from_tree._file_size(from_entry, from_stat)
643
to_size = to_tree._file_size(to_entry, to_stat)
643
from_size = self.source._file_size(from_entry, from_stat)
644
to_size = self.target._file_size(to_entry, to_stat)
644
645
if from_size != to_size:
645
646
changed_content = True
646
elif (from_tree.get_file_sha1(file_id, from_path, from_stat) !=
647
to_tree.get_file_sha1(file_id, to_path, to_stat)):
647
elif (self.source.get_file_sha1(file_id, from_path, from_stat) !=
648
self.target.get_file_sha1(file_id, to_path, to_stat)):
648
649
changed_content = True
649
650
elif from_kind == 'symlink':
650
if (from_tree.get_symlink_target(file_id) !=
651
to_tree.get_symlink_target(file_id)):
651
if (self.source.get_symlink_target(file_id) !=
652
self.target.get_symlink_target(file_id)):
652
653
changed_content = True
653
654
parent = (from_parent, to_entry.parent_id)
654
655
name = (from_name, to_entry.name)
668
669
if from_entry.parent_id not in to_paths:
669
get_to_path(from_tree.inventory[from_entry.parent_id])
670
get_to_path(self.source.inventory[from_entry.parent_id])
670
671
to_path = osutils.pathjoin(to_paths[from_entry.parent_id],
672
673
to_paths[from_entry.file_id] = to_path
684
685
parent = (from_entry.parent_id, None)
685
686
name = (from_entry.name, None)
686
687
from_kind, from_executable, stat_value = \
687
from_tree._comparison_data(from_entry, path)
688
self.source._comparison_data(from_entry, path)
688
689
kind = (from_kind, None)
689
690
executable = (from_executable, None)
690
691
changed_content = True