def commit_contains(repo: git.Repository, commit: git.Oid, maybe_ancestor: git.Oid) -> bool: # Does `commit` contain `maybe_ancestor`? if commit == maybe_ancestor: return True return repo.descendant_of(commit, maybe_ancestor)
def commit_contains(repo: git.Repository, commit: git.Oid, maybe_ancestor: git.Oid) -> bool: # Does `commit` contain `maybe_ancestor`? if commit not in repo: raise CommitNotFound(commit) if maybe_ancestor not in repo: raise CommitNotFound(maybe_ancestor) if commit == maybe_ancestor: return True return repo.descendant_of(commit, maybe_ancestor)