1037
1038
ver_a = osutils.safe_revision_id(ver_a)
1038
1039
ver_b = osutils.safe_revision_id(ver_b)
1039
1040
ancestors_b = set(self.get_ancestry(ver_b, topo_sorted=False))
1040
def status_a(revision, text):
1041
if revision in ancestors_b:
1042
return 'killed-b', text
1044
return 'new-a', text
1046
1042
ancestors_a = set(self.get_ancestry(ver_a, topo_sorted=False))
1047
def status_b(revision, text):
1048
if revision in ancestors_a:
1049
return 'killed-a', text
1051
return 'new-b', text
1053
1043
annotated_a = self.annotate(ver_a)
1054
1044
annotated_b = self.annotate(ver_b)
1055
plain_a = [t for (a, t) in annotated_a]
1056
plain_b = [t for (a, t) in annotated_b]
1057
blocks = KnitSequenceMatcher(None, plain_a, plain_b).get_matching_blocks()
1060
for ai, bi, l in blocks:
1061
# process all mismatched sections
1062
# (last mismatched section is handled because blocks always
1063
# includes a 0-length last block)
1064
for revision, text in annotated_a[a_cur:ai]:
1065
yield status_a(revision, text)
1066
for revision, text in annotated_b[b_cur:bi]:
1067
yield status_b(revision, text)
1069
# and now the matched section
1072
for text_a, text_b in zip(plain_a[ai:a_cur], plain_b[bi:b_cur]):
1073
assert text_a == text_b
1074
yield "unchanged", text_a
1045
return merge._plan_annotate_merge(annotated_a, annotated_b,
1046
ancestors_a, ancestors_b)
1077
1049
class _KnitComponentFile(object):