~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_versionedfile.py

  • Committer: John Arbash Meinel
  • Date: 2009-08-26 16:44:27 UTC
  • mto: (4634.6.10 2.0)
  • mto: This revision was merged to the branch mainline in revision 4664.
  • Revision ID: john@arbash-meinel.com-20090826164427-lrly8srccu1327oh
Teach VF.get_known_graph_ancestry to go to fallbacks (bug #419241)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1757
1757
        self.assertIsInstance(kg, _mod_graph.KnownGraph)
1758
1758
        self.assertEqual([key_a, key_b, key_c], list(kg.topo_sort()))
1759
1759
 
 
1760
    def test_known_graph_with_fallbacks(self):
 
1761
        f = self.get_versionedfiles('files')
 
1762
        if not self.graph:
 
1763
            raise TestNotApplicable('ancestry info only relevant with graph.')
 
1764
        if getattr(f, 'add_fallback_versioned_files', None) is None:
 
1765
            raise TestNotApplicable("%s doesn't support fallbacks"
 
1766
                                    % (f.__class__.__name__,))
 
1767
        key_a = self.get_simple_key('a')
 
1768
        key_b = self.get_simple_key('b')
 
1769
        key_c = self.get_simple_key('c')
 
1770
        # A     only in fallback
 
1771
        # |\
 
1772
        # | B
 
1773
        # |/
 
1774
        # C
 
1775
        g = self.get_versionedfiles('fallback')
 
1776
        g.add_lines(key_a, [], ['\n'])
 
1777
        f.add_fallback_versioned_files(g)
 
1778
        f.add_lines(key_b, [key_a], ['\n'])
 
1779
        f.add_lines(key_c, [key_a, key_b], ['\n'])
 
1780
        kg = f.get_known_graph_ancestry([key_c])
 
1781
        self.assertEqual([key_a, key_b, key_c], list(kg.topo_sort()))
 
1782
 
1760
1783
    def test_get_record_stream_empty(self):
1761
1784
        """An empty stream can be requested without error."""
1762
1785
        f = self.get_versionedfiles()