Part of bzrlib.graph View In Hierarchy
This class implements the iterator protocol, but additionally 1. provides a set of seen ancestors, and 2. allows some ancestries to be unsearched, via stop_searching_any
Method | __init__ | Undocumented |
Method | __repr__ | Undocumented |
Method | get_result | Get a SearchResult for the current state of this searcher. |
Method | step | Undocumented |
Method | next | Return the next ancestors of this revision. |
Method | next_with_ghosts | Return the next found ancestors, with ghosts split out. |
Method | __iter__ | Undocumented |
Method | find_seen_ancestors | Find ancestors of these revisions that have already been seen. |
Method | stop_searching_any | Remove any of the specified revisions from the search list. |
Method | start_searching | Add revisions to the search. |
Method | _advance | Advance the search. |
Method | _do_query | Query for revisions. |
Returns | A SearchResult for this search so far. The SearchResult is static - the search can be advanced and the search result will not be invalidated or altered. |
Ancestors are returned in the order they are seen in a breadth-first traversal. No ancestor will be returned more than once. Ancestors are returned before their parentage is queried, so ghosts and missing revisions (including the start revisions) are included in the result. This can save a round trip in LCA style calculation by allowing convergence to be detected without reading the data for the revision the convergence occurs on.
Returns | A set of revision_ids. |
Ancestors are returned in the order they are seen in a breadth-first traversal. No ancestor will be returned more than once. Ancestors are returned only after asking for their parents, which allows us to detect which revisions are ghosts and which are not.
Returns | A tuple with (present ancestors, ghost ancestors) sets. |
Updates self.seen, self._next_query, self._current_present, self._current_ghosts, self._current_parents and self._iterations.
Adds revisions to the seen set.
Parameters | revisions | Revisions to query. |
Returns | A tuple: (set(found_revisions), set(ghost_revisions), set(parents_of_found_revisions), dict(found_revisions:parents)). |
This function generally makes the assumption that querying for the parents of a node that has already been queried is reasonably cheap. (eg, not a round trip to a remote host).
None of the specified revisions are required to be present in the search list.
It is okay to call stop_searching_any() for revisions which were seen in previous iterations. It is the callers responsibility to call find_seen_ancestors() to make sure that current search tips that are ancestors of those revisions are also stopped. All explicitly stopped revisions will be excluded from the search result's get_keys(), though.
The parents of revisions will be returned from the next call to next() or next_with_ghosts(). If next_with_ghosts was the most recently used next* call then the return value is the result of looking up the ghost/not ghost status of revisions. (A tuple (present, ghosted)).