nixos-config/nixos/pkgs/gitlog2json/log.py

18 lines
447 B
Python

from git import Repo
import os
repo = Repo("/home/palo/dev/nixpkgs")
a = repo.head.log()[0]
current_hash = a.newhexsha
commit = repo.commit(current_hash)
commit.author
commit.committed_date
import json
json.dumps( { "commit_name" : commit.author.name, "message" : commit.message , "changes": commit.stats.files } )
commit.committed_date
commit.committer.email
commit.parents
commit.encoding
commit.authored_datetime
commit.size
commit.stats.total