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
 #!/usr/bin/env python
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
 # GPLv2 / GPLv3
3
 # GPLv2 / GPLv3
4
-import subprocess
5
 import datetime
4
 import datetime
6
 import glob
5
 import glob
7
 import os
6
 import os
8
 import pickle
7
 import pickle
9
 import re
8
 import re
10
 import shutil
9
 import shutil
10
+import subprocess
11
 import sys
11
 import sys
12
 import time
12
 import time
13
 import zlib
13
 import zlib
50
 def getkeyssortedbyvaluekey(d, key):
50
 def getkeyssortedbyvaluekey(d, key):
51
 	return map(lambda el : el[1], sorted(map(lambda el : (d[el][key], el), d.keys())))
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
 class DataCollector:
60
 class DataCollector:
54
 	"""Manages data collection from a revision control repository."""
61
 	"""Manages data collection from a revision control repository."""
55
 	def __init__(self):
62
 	def __init__(self):
866
 <head>
873
 <head>
867
 	<title>GitStats - %s</title>
874
 	<title>GitStats - %s</title>
868
 	<link rel="stylesheet" href="gitstats.css" type="text/css" />
875
 	<link rel="stylesheet" href="gitstats.css" type="text/css" />
869
-	<meta name="generator" content="GitStats" />
876
+	<meta name="generator" content="GitStats %s" />
870
 	<script type="text/javascript" src="sortable.js"></script>
877
 	<script type="text/javascript" src="sortable.js"></script>
871
 </head>
878
 </head>
872
 <body>
879
 <body>
873
-""" % self.title)
880
+""" % (self.title, getversion()))
874
 
881
 
875
 	def printNav(self, f):
882
 	def printNav(self, f):
876
 		f.write("""
883
 		f.write("""