Просмотр исходного кода

Merge branch 'master' of https://github.com/svenvh/gitstats

Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
Heikki Hokkanen 13 лет назад
Родитель
Сommit
09e324e3d1
1 измененных файлов: 8 добавлений и 2 удалений
  1. 8
    2
      gitstats

+ 8
- 2
gitstats Просмотреть файл

@@ -92,14 +92,16 @@ VERSION = 0
92 92
 def getversion():
93 93
 	global VERSION
94 94
 	if VERSION == 0:
95
-		VERSION = getpipeoutput(["git rev-parse --short %s" % getcommitrange('HEAD')]).split('\n')[0]
95
+		gitstats_repo = os.path.dirname(os.path.abspath(__file__))
96
+		VERSION = getpipeoutput(["git --git-dir=%s/.git --work-tree=%s rev-parse --short %s" %
97
+			(gitstats_repo, gitstats_repo, getcommitrange('HEAD').split('\n')[0])])
96 98
 	return VERSION
97 99
 
98 100
 def getgitversion():
99 101
 	return getpipeoutput(['git --version']).split('\n')[0]
100 102
 
101 103
 def getgnuplotversion():
102
-	return getpipeoutput(['gnuplot --version']).split('\n')[0]
104
+	return getpipeoutput(['%s --version' % gnuplot_cmd]).split('\n')[0]
103 105
 
104 106
 class DataCollector:
105 107
 	"""Manages data collection from a revision control repository."""
@@ -1368,6 +1370,10 @@ Default config values:
1368 1370
 			print 'FATAL: Output path is not a directory or does not exist'
1369 1371
 			sys.exit(1)
1370 1372
 
1373
+		if not getgnuplotversion():
1374
+			print 'gnuplot not found'
1375
+			sys.exit(1)
1376
+
1371 1377
 		print 'Output path: %s' % outputpath
1372 1378
 		cachefile = os.path.join(outputpath, 'gitstats.cache')
1373 1379