Browse Source

Include gitstats version in meta/generator.

Currently taken from "git rev-parse --short HEAD".
Heikki Hokkanen 17 years ago
parent
commit
10e1f6dc1c
1 changed files with 11 additions and 4 deletions
  1. 11
    4
      gitstats

+ 11
- 4
gitstats View File

@@ -1,13 +1,13 @@
1 1
 #!/usr/bin/env python
2
-# Copyright (c) 2007-2008 Heikki Hokkanen <hoxu@users.sf.net>
2
+# Copyright (c) 2007-2009 Heikki Hokkanen <hoxu@users.sf.net> & others (see doc/author.txt)
3 3
 # GPLv2 / GPLv3
4
-import subprocess
5 4
 import datetime
6 5
 import glob
7 6
 import os
8 7
 import pickle
9 8
 import re
10 9
 import shutil
10
+import subprocess
11 11
 import sys
12 12
 import time
13 13
 import zlib
@@ -50,6 +50,13 @@ def getkeyssortedbyvalues(dict):
50 50
 def getkeyssortedbyvaluekey(d, key):
51 51
 	return map(lambda el : el[1], sorted(map(lambda el : (d[el][key], el), d.keys())))
52 52
 
53
+VERSION = 0
54
+def getversion():
55
+	global VERSION
56
+	if VERSION == 0:
57
+		VERSION = getpipeoutput(["git rev-parse --short HEAD"]).split('\n')[0]
58
+	return VERSION
59
+
53 60
 class DataCollector:
54 61
 	"""Manages data collection from a revision control repository."""
55 62
 	def __init__(self):
@@ -866,11 +873,11 @@ plot 'lines_of_code.dat' using 1:2 w lines
866 873
 <head>
867 874
 	<title>GitStats - %s</title>
868 875
 	<link rel="stylesheet" href="gitstats.css" type="text/css" />
869
-	<meta name="generator" content="GitStats" />
876
+	<meta name="generator" content="GitStats %s" />
870 877
 	<script type="text/javascript" src="sortable.js"></script>
871 878
 </head>
872 879
 <body>
873
-""" % self.title)
880
+""" % (self.title, getversion()))
874 881
 
875 882
 	def printNav(self, f):
876 883
 		f.write("""