summarylogtreecommitdiffstats
path: root/getversion.py
blob: ddb60d7aa578391a624e05d90fc8fe5c18e920ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#/bin/python

from subprocess import check_output
from datetime import datetime

commit = check_output(["git", "show", "-s", "--format=%h", "HEAD"]).strip().decode("utf-8")
#timestamp = float(check_output(["git", "show", "-s", "--format=%ct", "HEAD"]).strip())
numCommits = check_output(["git", "rev-list", "--count", "HEAD"]).strip().decode("utf-8")

#print(commit)
#print(timestamp)
#print(datetime.utcfromtimestamp(timestamp).strftime("%Y-%m-%d"))
#print(numCommits)

print("r%s.%s"%(numCommits, commit))