Since then, I switched to proper solution, by calling git with appropriate arguments. Change wasn't that big, nor painful as I expected, and so I didn't document the transition at the time. However, it might be useful if somebody stumbles upon this (or, to my older self!), so use:
git rev-list --count HEAD
for commit count in the current branchgit rev-parse --abbrev-ref HEAD
for short name of the current branchgit log --format="%H" -n 1
for last commit-idgit log -1 --format=%ci
for date-time of the last commit (I'm using %ct to get Unix timestamp, then format it to my liking)
Call any of these from within Python via subprocess.check_output() function, and just collect string output, that's it.
No comments:
Post a Comment