anteater/git.py
Hubert Van De Walle 5b92d2a8a5 anteater v2
2025-05-07 11:01:35 +02:00

18 lines
490 B
Python

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")