Python の dulwich を使う例が多い
from dulwich.client import HttpGitClient
from dulwich.repo import MemoryRepo
from urllib.parse import urlparse
import itertools
def fetch_repo(repo=None, url=None):
url_object = urlparse(url)
client = HttpGitClient("://".join([url_object.scheme, url_object.netloc]))
remote_refs = client.fetch(url_object.path, repo)
for ref, sha1 in remote_refs.items():
repo.refs[ref] = sha1
return repo
def get_first_commit_time(repo):
for entry in repo.get_walker():
return entry.commit.commit_time