~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_versionedfile.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-07-09 00:44:25 UTC
  • mfrom: (4454.3.79 1.17-rework-annotate)
  • Revision ID: pqm@pqm.ubuntu.com-20090709004425-6tukiuklys5y02m5
(jam) Rework the internals of annotate to use a class object (fixes
        bug #387952)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1557
1557
        self.assertRaises(RevisionNotPresent,
1558
1558
            files.annotate, prefix + ('missing-key',))
1559
1559
 
 
1560
    def test_get_annotator(self):
 
1561
        files = self.get_versionedfiles()
 
1562
        self.get_diamond_files(files)
 
1563
        origin_key = self.get_simple_key('origin')
 
1564
        base_key = self.get_simple_key('base')
 
1565
        left_key = self.get_simple_key('left')
 
1566
        right_key = self.get_simple_key('right')
 
1567
        merged_key = self.get_simple_key('merged')
 
1568
        # annotator = files.get_annotator()
 
1569
        # introduced full text
 
1570
        origins, lines = files.get_annotator().annotate(origin_key)
 
1571
        self.assertEqual([(origin_key,)], origins)
 
1572
        self.assertEqual(['origin\n'], lines)
 
1573
        # a delta
 
1574
        origins, lines = files.get_annotator().annotate(base_key)
 
1575
        self.assertEqual([(base_key,)], origins)
 
1576
        # a merge
 
1577
        origins, lines = files.get_annotator().annotate(merged_key)
 
1578
        if self.graph:
 
1579
            self.assertEqual([
 
1580
                (base_key,),
 
1581
                (left_key,),
 
1582
                (right_key,),
 
1583
                (merged_key,),
 
1584
                ], origins)
 
1585
        else:
 
1586
            # Without a graph everything is new.
 
1587
            self.assertEqual([
 
1588
                (merged_key,),
 
1589
                (merged_key,),
 
1590
                (merged_key,),
 
1591
                (merged_key,),
 
1592
                ], origins)
 
1593
        self.assertRaises(RevisionNotPresent,
 
1594
            files.get_annotator().annotate, self.get_simple_key('missing-key'))
 
1595
 
1560
1596
    def test_construct(self):
1561
1597
        """Each parameterised test can be constructed on a transport."""
1562
1598
        files = self.get_versionedfiles()