|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+#!/usr/bin/python
|
|
|
2
|
+# Copyright (c) 2007 Heikki Hokkanen <hoxu@users.sf.net>
|
|
|
3
|
+# GPLv2
|
|
|
4
|
+import os
|
|
|
5
|
+import re
|
|
|
6
|
+import sys
|
|
|
7
|
+
|
|
|
8
|
+class DataCollector:
|
|
|
9
|
+ def __init__(self):
|
|
|
10
|
+ pass
|
|
|
11
|
+
|
|
|
12
|
+ def collect(self, dir):
|
|
|
13
|
+ self.dir = dir
|
|
|
14
|
+
|
|
|
15
|
+class GitDataCollector(DataCollector):
|
|
|
16
|
+ pass
|
|
|
17
|
+
|
|
|
18
|
+class ReportCreator:
|
|
|
19
|
+ def __init__(self):
|
|
|
20
|
+ pass
|
|
|
21
|
+
|
|
|
22
|
+ def create(self, data, path):
|
|
|
23
|
+ self.data = data
|
|
|
24
|
+ self.path = path
|
|
|
25
|
+
|
|
|
26
|
+class ConsoleReportCreator(ReportCreator):
|
|
|
27
|
+ def create(self, data, path):
|
|
|
28
|
+ ReportCreator.create(data, path)
|
|
|
29
|
+
|
|
|
30
|
+ pass
|
|
|
31
|
+
|
|
|
32
|
+class HTMLReportCreator(ReportCreator):
|
|
|
33
|
+ pass
|
|
|
34
|
+
|
|
|
35
|
+usage = """
|
|
|
36
|
+Usage: statgit [options] <gitpath> <outputpath>
|
|
|
37
|
+
|
|
|
38
|
+Options:
|
|
|
39
|
+ -o html
|
|
|
40
|
+"""
|
|
|
41
|
+
|
|
|
42
|
+if len(sys.argv) < 3:
|
|
|
43
|
+ print usage
|
|
|
44
|
+ sys.exit(0)
|
|
|
45
|
+
|
|
|
46
|
+gitpath = sys.argv[1]
|
|
|
47
|
+outputpath = sys.argv[2]
|
|
|
48
|
+
|
|
|
49
|
+print 'Git path: %s' % gitpath
|
|
|
50
|
+print 'Output path: %s' % outputpath
|
|
|
51
|
+
|
|
|
52
|
+data = GitDataCollector()
|
|
|
53
|
+data.collect(gitpath)
|
|
|
54
|
+
|
|
|
55
|
+report = ConsoleReportCreator()
|
|
|
56
|
+report.create(data, outputpath)
|
|
|
57
|
+
|
|
|
58
|
+
|