366
374
class TestReannotate(tests.TestCase):
368
def annotateEqual(self, expected, parents, newlines, revision_id):
376
def annotateEqual(self, expected, parents, newlines, revision_id,
369
378
annotate_list = list(annotate.reannotate(parents, newlines,
379
revision_id, blocks))
371
380
self.assertEqual(len(expected), len(annotate_list))
372
381
for e, a in zip(expected, annotate_list):
373
382
self.assertEqual(e, a)
377
386
self.annotateEqual(expected_2_1, [parent_2], new_1, 'blahblah')
378
387
self.annotateEqual(expected_1_2_2, [parent_1, parent_2], new_2,
390
def test_reannotate_no_parents(self):
391
self.annotateEqual(expected_1, [], new_1, 'blahblah')
393
def test_reannotate_left_matching_blocks(self):
394
"""Ensure that left_matching_blocks has an impact.
396
In this case, the annotation is ambiguous, so the hint isn't actually
399
parent = [('rev1', 'a\n')]
400
new_text = ['a\n', 'a\n']
401
blocks = [(0, 0, 1), (1, 2, 0)]
402
self.annotateEqual([('rev1', 'a\n'), ('rev2', 'a\n')], [parent],
403
new_text, 'rev2', blocks)
404
blocks = [(0, 1, 1), (1, 2, 0)]
405
self.annotateEqual([('rev2', 'a\n'), ('rev1', 'a\n')], [parent],
406
new_text, 'rev2', blocks)