~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_graph.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-10-30 23:53:42 UTC
  • mfrom: (3808.1.4 stop_searching)
  • Revision ID: pqm@pqm.ubuntu.com-20081030235342-3ttqulydt0irv350
Improve behaviour of stop_searching_any. Fixes regression in
        _walk_to_common_revisions that causes unnecessary data to be
        fetched. (Andrew Bennetts, John Arbash Meinel)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1082
1082
        search = graph._make_breadth_first_searcher(['head'])
1083
1083
        self.assertSeenAndResult(expected, search, search.next_with_ghosts)
1084
1084
 
 
1085
    def test_breadth_first_stop_searching_late(self):
 
1086
        # A client should be able to say 'stop node X' and have it excluded
 
1087
        # from the result even if X was seen in an older iteration of the
 
1088
        # search.
 
1089
        graph = self.make_graph({
 
1090
            'head':['middle'],
 
1091
            'middle':['child'],
 
1092
            'child':[NULL_REVISION],
 
1093
            NULL_REVISION:[],
 
1094
            })
 
1095
        search = graph._make_breadth_first_searcher(['head'])
 
1096
        expected = [
 
1097
            (set(['head']), (set(['head']), set(['middle']), 1),
 
1098
             ['head'], None, None),
 
1099
            (set(['head', 'middle']), (set(['head']), set(['child']), 2),
 
1100
             ['head', 'middle'], None, None),
 
1101
            # 'middle' came from the previous iteration, but we don't stop
 
1102
            # searching it until *after* advancing the searcher.
 
1103
            (set(['head', 'middle', 'child']),
 
1104
             (set(['head']), set(['middle', 'child']), 1),
 
1105
             ['head'], None, ['middle', 'child']),
 
1106
            ]
 
1107
        self.assertSeenAndResult(expected, search, search.next)
 
1108
        # using next_with_ghosts:
 
1109
        search = graph._make_breadth_first_searcher(['head'])
 
1110
        self.assertSeenAndResult(expected, search, search.next_with_ghosts)
 
1111
 
1085
1112
    def test_breadth_first_get_result_ghosts_are_excluded(self):
1086
1113
        graph = self.make_graph({
1087
1114
            'head':['child', 'ghost'],