/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_graph.py

  • Committer: Robert Collins
  • Date: 2008-01-17 22:41:32 UTC
  • mto: (3184.3.1 use-SearchResult)
  • mto: This revision was merged to the branch mainline in revision 3192.
  • Revision ID: robertc@robertcollins.net-20080117224132-z2plxu9lh0g3rpz7
Handle stopping ghosts in searches properly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
818
818
        search.start_searching(['head'])
819
819
        self.assertSeenAndResult(expected, search, search.next_with_ghosts)
820
820
 
 
821
    def test_breadth_first_stop_searching_not_queried(self):
 
822
        # A client should be able to say 'stop node X' even if X has not been
 
823
        # returned to the client.
 
824
        graph = self.make_graph({
 
825
            'head':['child', 'ghost1'],
 
826
            'child':[NULL_REVISION],
 
827
            NULL_REVISION:[],
 
828
            })
 
829
        search = graph._make_breadth_first_searcher(['head'])
 
830
        expected = [
 
831
            # NULL_REVISION and ghost1 have not been returned
 
832
            (set(['head']), (set(['head']), set(['child', 'ghost1']), 1),
 
833
             ['head'], None, [NULL_REVISION, 'ghost1']),
 
834
            # ghost1 has been returned, NULL_REVISION is to be returned in the
 
835
            # next iteration.
 
836
            (set(['head', 'child', 'ghost1']),
 
837
             (set(['head']), set(['ghost1', NULL_REVISION]), 2),
 
838
             ['head', 'child'], None, [NULL_REVISION, 'ghost1']),
 
839
            ]
 
840
        self.assertSeenAndResult(expected, search, search.next)
 
841
        # using next_with_ghosts:
 
842
        search = graph._make_breadth_first_searcher(['head'])
 
843
        self.assertSeenAndResult(expected, search, search.next_with_ghosts)
 
844
 
821
845
    def test_breadth_first_get_result_ghosts_are_excluded(self):
822
846
        graph = self.make_graph({
823
847
            'head':['child', 'ghost'],