~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_graph.py

  • Committer: Robert Collins
  • Date: 2008-01-16 00:10:50 UTC
  • mto: (3184.3.1 use-SearchResult)
  • mto: This revision was merged to the branch mainline in revision 3192.
  • Revision ID: robertc@robertcollins.net-20080116001050-za7seokm1owjr7ee
Automatically exclude ghosts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
751
751
        graph = self.make_graph({
752
752
            'head':['child'],
753
753
            'child':[NULL_REVISION],
 
754
            NULL_REVISION:[],
754
755
            })
755
756
        search = graph._make_breadth_first_searcher(['head'])
756
757
        # At the start, nothing has been seen, to its all excluded:
776
777
            'otherhead':['otherchild'],
777
778
            'otherchild':['excluded'],
778
779
            'excluded':[NULL_REVISION],
 
780
            NULL_REVISION:[]
779
781
            })
780
782
        search = graph._make_breadth_first_searcher([])
781
783
        # Starting with nothing and adding a search works:
805
807
        search.start_searching(['head'])
806
808
        self.assertSeenAndRecipes(expected, search, search.next_with_ghosts)
807
809
 
 
810
    def test_breadth_first_get_recipe_ghosts_are_excluded(self):
 
811
        graph = self.make_graph({
 
812
            'head':['child', 'ghost'],
 
813
            'child':[NULL_REVISION],
 
814
            NULL_REVISION:[],
 
815
            })
 
816
        search = graph._make_breadth_first_searcher(['head'])
 
817
        # using next:
 
818
        expected = [
 
819
            (set(['head']),
 
820
             (set(['head']), set(['ghost', 'child'])),
 
821
             None, None),
 
822
            (set(['head', 'child', 'ghost']),
 
823
             (set(['head']), set([NULL_REVISION, 'ghost'])),
 
824
             None, None),
 
825
            ]
 
826
        self.assertSeenAndRecipes(expected, search, search.next)
 
827
        # using next_with_ghosts:
 
828
        search = graph._make_breadth_first_searcher(['head'])
 
829
        self.assertSeenAndRecipes(expected, search, search.next_with_ghosts)
 
830
 
808
831
 
809
832
class TestCachingParentsProvider(tests.TestCase):
810
833