~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_graph.py

  • Committer: John Arbash Meinel
  • Date: 2008-10-30 15:20:00 UTC
  • mto: This revision was merged to the branch mainline in revision 3812.
  • Revision ID: john@arbash-meinel.com-20081030152000-pzfowc2mapr41kut
make _walk_to_common responsible for stopping ancestors
and assume that callers that call 'stop' late will handle ancestors,
so don't bother testing what happens if they don't.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1101
1101
            # 'middle' came from the previous iteration, but we don't stop
1102
1102
            # searching it until *after* advancing the searcher.
1103
1103
            (set(['head', 'middle', 'child']),
1104
 
             (set(['head']), set(['middle', 'null:']), 2),
1105
 
             ['head', 'child'], None, ['middle']),
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
 
 
1112
 
    def test_breadth_first_stop_searching_late_more_keys(self):
1113
 
        # Like test_breadth_first_stop_searching_late, but stop searching all
1114
 
        # the keys seen between the earlier iteration and the last (rather than
1115
 
        # just one).
1116
 
        graph = self.make_graph({
1117
 
            'head':['middle'],
1118
 
            'middle':['child'],
1119
 
            'child':[NULL_REVISION],
1120
 
            NULL_REVISION:[],
1121
 
            })
1122
 
        search = graph._make_breadth_first_searcher(['head'])
1123
 
        expected = [
1124
 
            (set(['head']), (set(['head']), set(['middle']), 1),
1125
 
             ['head'], None, None),
1126
 
            (set(['head', 'middle']), (set(['head']), set(['child']), 2),
1127
 
             ['head', 'middle'], None, None),
1128
 
            # 'middle' came from the previous iteration, but we don't stop
1129
 
            # searching it until *after* advancing the searcher.
1130
 
            (set(['head', 'middle', 'child']),
1131
 
             (set(['head']), set(['middle']), 1),
 
1104
             (set(['head']), set(['middle', 'child']), 1),
1132
1105
             ['head'], None, ['middle', 'child']),
1133
1106
            ]
1134
1107
        self.assertSeenAndResult(expected, search, search.next)