619
619
def _diff(self, text_diff, from_label, tree, to_label, to_entry, to_tree,
620
620
output_to, reverse=False):
621
621
"""See InventoryEntry._diff."""
623
from_text = tree.get_file(self.file_id).readlines()
625
to_text = to_tree.get_file(to_entry.file_id).readlines()
629
text_diff(from_label, from_text,
630
to_label, to_text, output_to)
632
text_diff(to_label, to_text,
633
from_label, from_text, output_to)
634
except errors.BinaryFile:
636
label_pair = (to_label, from_label)
638
label_pair = (from_label, to_label)
640
("Binary files %s and %s differ\n" % label_pair).encode('utf8'))
622
from bzrlib.diff import Differ
623
from_file_id = self.file_id
625
to_file_id = to_entry.file_id
629
to_file_id, from_file_id = from_file_id, to_file_id
630
tree, to_tree = to_tree, tree
631
from_label, to_label = to_label, from_label
632
differ = Differ(tree, to_tree, output_to, text_diff)
633
return differ.diff_text(from_file_id, to_file_id, from_label, to_label)
642
635
def has_text(self):
643
636
"""See InventoryEntry.has_text."""
735
728
def _diff(self, text_diff, from_label, tree, to_label, to_entry, to_tree,
736
729
output_to, reverse=False):
737
730
"""See InventoryEntry._diff."""
738
from_text = self.symlink_target
731
from bzrlib.diff import Differ
732
old_target = self.symlink_target
739
733
if to_entry is not None:
740
to_text = to_entry.symlink_target
745
output_to.write('=== target changed %r => %r\n' % (from_text, to_text))
748
output_to.write('=== target was %r\n' % self.symlink_target)
750
output_to.write('=== target is %r\n' % self.symlink_target)
734
new_target = to_entry.symlink_target
743
new_target, old_target = old_target, new_target
744
differ = Differ(old_tree, new_tree, output_to, text_diff)
745
return differ.diff_symlink(old_target, new_target)
752
747
def __init__(self, file_id, name, parent_id):
753
748
super(InventoryLink, self).__init__(file_id, name, parent_id)