module documentation

Implementation of merge-base following the approach of git.

Class WorkList Priority queue for commit processing using a min-heap.
Function can_fast_forward Is it possible to fast-forward from c1 to c2?
Function find_merge_base Find lowest common ancestors of commit_ids[0] and any of commits_ids[1:].
Function find_octopus_base Find lowest common ancestors of all provided commit_ids.
Function independent Filter commits to only those that are not reachable from others.
Type Variable T Undocumented
Function _find_lcas Find lowest common ancestors between commits.
def can_fast_forward(repo: BaseRepo, c1: ObjectID, c2: ObjectID) -> bool:

Is it possible to fast-forward from c1 to c2?

Parameters
repo:BaseRepoRepository to retrieve objects from
c1:ObjectIDCommit id for first commit
c2:ObjectIDCommit id for second commit
Returns
boolUndocumented
def find_merge_base(repo: BaseRepo, commit_ids: Sequence[ObjectID]) -> list[ObjectID]:

Find lowest common ancestors of commit_ids[0] and any of commits_ids[1:].

Parameters
repo:BaseRepoRepository object
commit_ids:Sequence[ObjectID]list of commit ids
Returns
list[ObjectID]list of lowest common ancestor commit_ids
def find_octopus_base(repo: BaseRepo, commit_ids: Sequence[ObjectID]) -> list[ObjectID]:

Find lowest common ancestors of all provided commit_ids.

Parameters
repo:BaseRepoRepository
commit_ids:Sequence[ObjectID]list of commit ids
Returns
list[ObjectID]list of lowest common ancestor commit_ids
def independent(repo: BaseRepo, commit_ids: Sequence[ObjectID]) -> list[ObjectID]:

Filter commits to only those that are not reachable from others.

Parameters
repo:BaseRepoRepository object
commit_ids:Sequence[ObjectID]list of commit ids to filter
Returns
list[ObjectID]list of commit ids that are not ancestors of any other commits in the list
T =

Undocumented

Value
TypeVar('T')
def _find_lcas(lookup_parents: Callable[[ObjectID], list[ObjectID]], c1: ObjectID, c2s: Sequence[ObjectID], lookup_stamp: Callable[[ObjectID], int], min_stamp: int = 0, shallows: set[ObjectID] | None = None) -> list[ObjectID]:

Find lowest common ancestors between commits.

Parameters
lookup_parents:Callable[[ObjectID], list[ObjectID]]Function to get parent commits
c1:ObjectIDFirst commit
c2s:Sequence[ObjectID]List of second commits
lookup_stamp:Callable[[ObjectID], int]Function to get commit timestamp
min_stamp:intMinimum timestamp to consider
shallows:set[ObjectID] | NoneSet of shallow commits
Returns
list[ObjectID]List of lowest common ancestor commit IDs