Selaa lähdekoodia

General: first and last commit dates.

Heikki Hokkanen 18 vuotta sitten
vanhempi
commit
c881e6ec1f
3 muutettua tiedostoa jossa 15 lisäystä ja 2 poistoa
  1. 2
    0
      TODO.txt
  2. 12
    2
      statgit
  3. 1
    0
      statgit.css

+ 2
- 0
TODO.txt Näytä tiedosto

@@ -1,5 +1,6 @@
1 1
 - development statistics generator for git
2 2
 	- should be as versatile as statcvs / statsvn
3
+- XXX optimize author's first/last rev getting
3 4
 
4 5
 [Information]
5 6
 - git-log
@@ -30,6 +31,7 @@
30 31
 		- show only first 10 and rest on separate page?
31 32
 	- DONE (T): author, commits (%), LOC?, first commit, last commit
32 33
 	- DONE (T): Developer of the Month: month, author, commits, LOC?
34
+	- DONE (T): Author of Year
33 35
 
34 36
 - Files
35 37
 	- Total Files

+ 12
- 2
statgit Näytä tiedosto

@@ -96,6 +96,8 @@ class GitDataCollector(DataCollector):
96 96
 		self.author_of_month = {} # month -> author -> commits
97 97
 		self.author_of_year = {} # year -> author -> commits
98 98
 		self.commits_by_month = {} # month -> commits
99
+		self.first_commit_stamp = 0
100
+		self.last_commit_stamp = 0
99 101
 
100 102
 		lines = getoutput('git-rev-list --pretty=format:"%at %an" HEAD |grep -v ^commit').split('\n')
101 103
 		for line in lines:
@@ -103,6 +105,10 @@ class GitDataCollector(DataCollector):
103 105
 			stamp = int(parts[0])
104 106
 			author = ' '.join(parts[1:])
105 107
 
108
+			if self.last_commit_stamp == 0:
109
+				self.last_commit_stamp = stamp
110
+			self.first_commit_stamp = stamp
111
+
106 112
 			yymm = datetime.datetime.fromtimestamp(stamp).strftime('%Y-%m')
107 113
 			if yymm in self.author_of_month:
108 114
 				if author in self.author_of_month[yymm]:
@@ -126,8 +132,6 @@ class GitDataCollector(DataCollector):
126 132
 			else:
127 133
 				self.author_of_year[yy] = {}
128 134
 				self.author_of_year[yy][author] = 1
129
-
130
-		print self.author_of_month
131 135
 	
132 136
 	def getActivityByDayOfWeek(self):
133 137
 		return self.activity_by_day_of_week
@@ -152,6 +156,12 @@ class GitDataCollector(DataCollector):
152 156
 		lines = getoutput('git-rev-list --all --pretty=format:%an |grep -v ^commit |sort |uniq')
153 157
 		return lines.split('\n')
154 158
 	
159
+	def getFirstCommitDate(self):
160
+		return datetime.datetime.fromtimestamp(self.first_commit_stamp)
161
+	
162
+	def getLastCommitDate(self):
163
+		return datetime.datetime.fromtimestamp(self.last_commit_stamp)
164
+	
155 165
 	def getTags(self):
156 166
 		lines = getoutput('git-show-ref --tags |cut -d/ -f3')
157 167
 		return lines.split('\n')

+ 1
- 0
statgit.css Näytä tiedosto

@@ -21,6 +21,7 @@ dd {
21 21
 table {
22 22
 	border: 1px solid black;
23 23
 	border-collapse: collapse;
24
+	font-size: 90%;
24 25
 }
25 26
 
26 27
 tr {