Include gitstats version in meta/generator.

Currently taken from "git rev-parse --short HEAD".
This commit is contained in:
Heikki Hokkanen 2009-01-14 18:20:23 +02:00
parent a1d9c11c30
commit 10e1f6dc1c

View File

@ -1,13 +1,13 @@
#!/usr/bin/env python #!/usr/bin/env python
# Copyright (c) 2007-2008 Heikki Hokkanen <hoxu@users.sf.net> # Copyright (c) 2007-2009 Heikki Hokkanen <hoxu@users.sf.net> & others (see doc/author.txt)
# GPLv2 / GPLv3 # GPLv2 / GPLv3
import subprocess
import datetime import datetime
import glob import glob
import os import os
import pickle import pickle
import re import re
import shutil import shutil
import subprocess
import sys import sys
import time import time
import zlib import zlib
@ -50,6 +50,13 @@ def getkeyssortedbyvalues(dict):
def getkeyssortedbyvaluekey(d, key): def getkeyssortedbyvaluekey(d, key):
return map(lambda el : el[1], sorted(map(lambda el : (d[el][key], el), d.keys()))) return map(lambda el : el[1], sorted(map(lambda el : (d[el][key], el), d.keys())))
VERSION = 0
def getversion():
global VERSION
if VERSION == 0:
VERSION = getpipeoutput(["git rev-parse --short HEAD"]).split('\n')[0]
return VERSION
class DataCollector: class DataCollector:
"""Manages data collection from a revision control repository.""" """Manages data collection from a revision control repository."""
def __init__(self): def __init__(self):
@ -866,11 +873,11 @@ plot 'lines_of_code.dat' using 1:2 w lines
<head> <head>
<title>GitStats - %s</title> <title>GitStats - %s</title>
<link rel="stylesheet" href="gitstats.css" type="text/css" /> <link rel="stylesheet" href="gitstats.css" type="text/css" />
<meta name="generator" content="GitStats" /> <meta name="generator" content="GitStats %s" />
<script type="text/javascript" src="sortable.js"></script> <script type="text/javascript" src="sortable.js"></script>
</head> </head>
<body> <body>
""" % self.title) """ % (self.title, getversion()))
def printNav(self, f): def printNav(self, f):
f.write(""" f.write("""