~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_knit.py

  • Committer: John Arbash Meinel
  • Date: 2009-07-06 19:37:07 UTC
  • mto: This revision was merged to the branch mainline in revision 4522.
  • Revision ID: john@arbash-meinel.com-20090706193707-ipgtqgtlkua2pxno
Ensure that _KnitAnnotator also supports add_special_text.

It already had some support for handling texts that were already present.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1456
1456
                           ['line1\n', 'line2\n'], ('fulltext', False))
1457
1457
        ann._num_compression_children['parent-id'] = 2
1458
1458
 
 
1459
    def test_annotate_special_text(self):
 
1460
        ann = self.make_annotator()
 
1461
        vf = ann._vf
 
1462
        rev1_key = ('rev-1',)
 
1463
        rev2_key = ('rev-2',)
 
1464
        rev3_key = ('rev-3',)
 
1465
        spec_key = ('special:',)
 
1466
        vf.add_lines(rev1_key, [], ['initial content\n'])
 
1467
        vf.add_lines(rev2_key, [rev1_key], ['initial content\n',
 
1468
                                            'common content\n',
 
1469
                                            'content in 2\n'])
 
1470
        vf.add_lines(rev3_key, [rev1_key], ['initial content\n',
 
1471
                                            'common content\n',
 
1472
                                            'content in 3\n'])
 
1473
        spec_text = ('initial content\n'
 
1474
                     'common content\n'
 
1475
                     'content in 2\n'
 
1476
                     'content in 3\n')
 
1477
        ann.add_special_text(spec_key, [rev2_key, rev3_key], spec_text)
 
1478
        anns, lines = ann.annotate(spec_key)
 
1479
        self.assertEqual([(rev1_key,),
 
1480
                          (rev2_key, rev3_key),
 
1481
                          (rev2_key,),
 
1482
                          (rev3_key,),
 
1483
                         ], anns)
 
1484
        self.assertEqualDiff(spec_text, ''.join(lines))
 
1485
 
1459
1486
 
1460
1487
class KnitTests(TestCaseWithTransport):
1461
1488
    """Class containing knit test helper routines."""