class documentation

class GraphTraversalReachability:

Constructor: GraphTraversalReachability(object_store)

View In Hierarchy

Naive graph traversal implementation of ObjectReachabilityProvider.

This implementation wraps existing graph traversal functions (_collect_ancestors, _collect_filetree_revs) to provide the standard reachability interface without any performance optimizations.

Method __init__ Initialize the graph traversal provider.
Method get_reachable_commits Get all commits reachable from heads, excluding those in exclude.
Method get_reachable_objects Get all objects (commits + trees + blobs) reachable from commits.
Method get_tree_objects Get all trees and blobs reachable from the given trees.
Instance Variable store Undocumented
def __init__(self, object_store: BaseObjectStore):

Initialize the graph traversal provider.

Parameters
object_store:BaseObjectStoreObject store to query
def get_reachable_commits(self, heads: Iterable[ObjectID], exclude: Iterable[ObjectID] | None = None, shallow: Set[ObjectID] | None = None) -> set[ObjectID]:

Get all commits reachable from heads, excluding those in exclude.

Uses _collect_ancestors for commit traversal.

Parameters
heads:Iterable[ObjectID]Starting commit SHAs
exclude:Iterable[ObjectID] | NoneCommit SHAs to exclude (and their ancestors)
shallow:Set[ObjectID] | NoneSet of shallow commit boundaries
Returns
set[ObjectID]Set of commit SHAs reachable from heads but not from exclude
def get_reachable_objects(self, commits: Iterable[ObjectID], exclude_commits: Iterable[ObjectID] | None = None) -> set[ObjectID]:

Get all objects (commits + trees + blobs) reachable from commits.

Parameters
commits:Iterable[ObjectID]Starting commit SHAs
exclude_commits:Iterable[ObjectID] | NoneCommits whose objects should be excluded
Returns
set[ObjectID]Set of all object SHAs (commits, trees, blobs)
def get_tree_objects(self, tree_shas: Iterable[ObjectID]) -> set[ObjectID]:

Get all trees and blobs reachable from the given trees.

Uses _collect_filetree_revs for tree traversal.

Parameters
tree_shas:Iterable[ObjectID]Starting tree SHAs
Returns
set[ObjectID]Set of tree and blob SHAs
store =

Undocumented