~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/graph.py

  • Committer: Jelmer Vernooij
  • Date: 2011-12-05 15:16:52 UTC
  • mto: This revision was merged to the branch mainline in revision 6348.
  • Revision ID: jelmer@samba.org-20111205151652-8y6qgvv1qkbv5f71
Fix get_state().

Show diffs side-by-side

added added

removed removed

Lines of Context:
1346
1346
        return ('_BreadthFirstSearcher(iterations=%d, %s,'
1347
1347
                ' seen=%r)' % (self._iterations, search, list(self.seen)))
1348
1348
 
1349
 
    def get_result(self):
1350
 
        """Get a SearchResult for the current state of this searcher.
 
1349
    def get_state(self):
 
1350
        """Get the current state of this searcher.
1351
1351
 
1352
 
        :return: A SearchResult for this search so far. The SearchResult is
1353
 
            static - the search can be advanced and the search result will not
1354
 
            be invalidated or altered.
 
1352
        :return: Tuple with started keys, excludes and included keys
1355
1353
        """
1356
1354
        if self._returning == 'next':
1357
1355
            # We have to know the current nodes children to be able to list the
1368
1366
            next_query = self._next_query
1369
1367
        excludes = self._stopped_keys.union(next_query)
1370
1368
        included_keys = self.seen.difference(excludes)
 
1369
        return self._started_keys, excludes, included_keys
 
1370
 
 
1371
    def _get_result(self):
 
1372
        """Get a SearchResult for the current state of this searcher.
 
1373
 
 
1374
        :return: A SearchResult for this search so far. The SearchResult is
 
1375
            static - the search can be advanced and the search result will not
 
1376
            be invalidated or altered.
 
1377
        """
1371
1378
        from bzrlib.vf_search import SearchResult
1372
 
        return SearchResult(self._started_keys, excludes, len(included_keys),
 
1379
        (started_keys, excludes, included_keys) = self.get_state()
 
1380
        return SearchResult(started_keys, excludes, len(included_keys),
1373
1381
            included_keys)
1374
1382
 
1375
1383
    def step(self):