Browse Source

Workaround for git repository.

Heikki Hokkanen 18 years ago
parent
commit
2a6d586349
2 changed files with 14 additions and 3 deletions
  1. 2
    2
      doc/TODO.txt
  2. 12
    1
      gitstats

+ 2
- 2
doc/TODO.txt View File

5
 
5
 
6
 - style class for images (<div class="graph">)?
6
 - style class for images (<div class="graph">)?
7
 - better style for images & tables (keep next to each other?)
7
 - better style for images & tables (keep next to each other?)
8
+- parameter --style default.css
8
 
9
 
9
 [0.0.1]
10
 [0.0.1]
10
 - copy/link gitstats.css to target dir
11
 - copy/link gitstats.css to target dir
11
-- rename to gitstats ?
12
-	- make $PROJECT_NAME a variable
12
+	- find out pwd or home dir?
13
 
13
 
14
 [Unsorted]
14
 [Unsorted]
15
 - use sortable.js
15
 - use sortable.js

+ 12
- 1
gitstats View File

6
 import glob
6
 import glob
7
 import os
7
 import os
8
 import re
8
 import re
9
+import shutil
9
 import sys
10
 import sys
10
 import time
11
 import time
11
 
12
 
23
 # TODO getdictkeyssortedbyvaluekey(dict, key) - eg. dict['author'] = { 'commits' : 512 } - ...key(dict, 'commits')
24
 # TODO getdictkeyssortedbyvaluekey(dict, key) - eg. dict['author'] = { 'commits' : 512 } - ...key(dict, 'commits')
24
 
25
 
25
 class DataCollector:
26
 class DataCollector:
27
+	"""Manages data collection from a revision control repository."""
26
 	def __init__(self):
28
 	def __init__(self):
27
 		self.stamp_created = time.time()
29
 		self.stamp_created = time.time()
28
 		pass
30
 		pass
230
 				self.extensions[ext] = {'files': 0, 'lines': 0}
232
 				self.extensions[ext] = {'files': 0, 'lines': 0}
231
 
233
 
232
 			self.extensions[ext]['files'] += 1
234
 			self.extensions[ext]['files'] += 1
233
-			self.extensions[ext]['lines'] += int(getoutput('wc -l < %s' % line, quiet = True))
235
+			try:
236
+				self.extensions[ext]['lines'] += int(getoutput('wc -l < %s' % line, quiet = True))
237
+			except:
238
+				print 'Warning: Could not count lines for file "%s"' % line
234
 	
239
 	
235
 	def getActivityByDayOfWeek(self):
240
 	def getActivityByDayOfWeek(self):
236
 		return self.activity_by_day_of_week
241
 		return self.activity_by_day_of_week
283
 		return datetime.datetime.fromtimestamp(stamp).strftime('%Y-%m-%d')
288
 		return datetime.datetime.fromtimestamp(stamp).strftime('%Y-%m-%d')
284
 
289
 
285
 class ReportCreator:
290
 class ReportCreator:
291
+	"""Creates the actual report based on given data."""
286
 	def __init__(self):
292
 	def __init__(self):
287
 		pass
293
 		pass
288
 	
294
 	
294
 	def create(self, data, path):
300
 	def create(self, data, path):
295
 		ReportCreator.create(self, data, path)
301
 		ReportCreator.create(self, data, path)
296
 
302
 
303
+		# TODO copy the CSS if it does not exist
304
+		if not os.path.exists(path + '/gitstats.css'):
305
+			#shutil.copyfile('')
306
+			pass
307
+
297
 		f = open(path + "/index.html", 'w')
308
 		f = open(path + "/index.html", 'w')
298
 		format = '%Y-%m-%d %H:%m:%S'
309
 		format = '%Y-%m-%d %H:%m:%S'
299
 		self.printHeader(f)
310
 		self.printHeader(f)