Last active
August 10, 2017 14:59
-
-
Save miikka/3ab4bb4b24f87ed6023a8cb76610823c to your computer and use it in GitHub Desktop.
Cumulative committer count data from a git repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# git log --format="%ae,%at" | python cumulative.py | |
from datetime import date | |
import fileinput | |
committers = dict() | |
for line in fileinput.input(): | |
author, time = line.split(",") | |
# Warning: the comparison is a string comparison, not a number comparison | |
if author not in committers or committers[author] > time: | |
committers[author] = time | |
ac = 0 | |
print("date,count,author") | |
for author, time in sorted(committers.items(), key=lambda x: x[1]): | |
ac = ac + 1 | |
d = date.fromtimestamp(int(time)) | |
print("%s,%s,%s" % (d, ac, author)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment