예제 #1
0
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)
예제 #2
0
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)