import subprocess class GitRepository: def __init__(self, path): self.path = path def checkout(self, hash): subprocess.check_call(["git", "-C", self.path, "checkout", hash]) def between(self, old_hash, new_hash): res = subprocess.run( ["git", "-C", self.path, "log", "--oneline", f"{old_hash}..{new_hash}"], capture_output=True, check=True, ) return res.stdout.decode("utf-8").rstrip().split("\n")