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

26 lines
479 B
Python
Raw Normal View History

2019-10-24 02:20:38 +02:00
from git import Repo
import os
2023-04-26 09:23:56 +02:00
2019-10-24 02:20:38 +02:00
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
2023-04-26 09:23:56 +02:00
json.dumps(
{
"commit_name": commit.author.name,
"message": commit.message,
"changes": commit.stats.files,
}
)
2019-10-24 02:20:38 +02:00
commit.committed_date
commit.committer.email
commit.parents
commit.encoding
commit.authored_datetime
commit.size
commit.stats.total