816
816
for lineno, insert_id, dset, line in w.walk(version_ids):
817
817
yield lineno, insert_id, dset, line
819
def plan_merge(self, ver_a, ver_b):
820
"""See VersionedFile.plan_merge."""
821
ancestors_b = set(self.get_ancestry(ver_b))
822
def status_a(revision, text):
823
if revision in ancestors_b:
824
return 'killed-b', text
828
ancestors_a = set(self.get_ancestry(ver_a))
829
def status_b(revision, text):
830
if revision in ancestors_a:
831
return 'killed-a', text
835
annotated_a = self.annotate(ver_a)
836
annotated_b = self.annotate(ver_b)
837
plain_a = [t for (a, t) in annotated_a]
838
plain_b = [t for (a, t) in annotated_b]
839
blocks = SequenceMatcher(None, plain_a, plain_b).get_matching_blocks()
842
for ai, bi, l in blocks:
843
# process all mismatched sections
844
# (last mismatched section is handled because blocks always
845
# includes a 0-length last block)
846
for revision, text in annotated_a[a_cur:ai]:
847
yield status_a(revision, text)
848
for revision, text in annotated_b[b_cur:bi]:
849
yield status_b(revision, text)
851
# and now the matched section
854
for text_a, text_b in zip(plain_a[ai:a_cur], plain_b[bi:b_cur]):
855
assert text_a == text_b
856
yield "unchanged", text_a
820
859
class _KnitComponentFile(object):
821
860
"""One of the files used to implement a knit database"""