Browse Source

General: first and last commit dates.

Heikki Hokkanen 18 years ago
parent
commit
c881e6ec1f
3 changed files with 15 additions and 2 deletions
  1. 2
    0
      TODO.txt
  2. 12
    2
      statgit
  3. 1
    0
      statgit.css

+ 2
- 0
TODO.txt View File

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

+ 12
- 2
statgit View File

96
 		self.author_of_month = {} # month -> author -> commits
96
 		self.author_of_month = {} # month -> author -> commits
97
 		self.author_of_year = {} # year -> author -> commits
97
 		self.author_of_year = {} # year -> author -> commits
98
 		self.commits_by_month = {} # month -> commits
98
 		self.commits_by_month = {} # month -> commits
99
+		self.first_commit_stamp = 0
100
+		self.last_commit_stamp = 0
99
 
101
 
100
 		lines = getoutput('git-rev-list --pretty=format:"%at %an" HEAD |grep -v ^commit').split('\n')
102
 		lines = getoutput('git-rev-list --pretty=format:"%at %an" HEAD |grep -v ^commit').split('\n')
101
 		for line in lines:
103
 		for line in lines:
103
 			stamp = int(parts[0])
105
 			stamp = int(parts[0])
104
 			author = ' '.join(parts[1:])
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
 			yymm = datetime.datetime.fromtimestamp(stamp).strftime('%Y-%m')
112
 			yymm = datetime.datetime.fromtimestamp(stamp).strftime('%Y-%m')
107
 			if yymm in self.author_of_month:
113
 			if yymm in self.author_of_month:
108
 				if author in self.author_of_month[yymm]:
114
 				if author in self.author_of_month[yymm]:
126
 			else:
132
 			else:
127
 				self.author_of_year[yy] = {}
133
 				self.author_of_year[yy] = {}
128
 				self.author_of_year[yy][author] = 1
134
 				self.author_of_year[yy][author] = 1
129
-
130
-		print self.author_of_month
131
 	
135
 	
132
 	def getActivityByDayOfWeek(self):
136
 	def getActivityByDayOfWeek(self):
133
 		return self.activity_by_day_of_week
137
 		return self.activity_by_day_of_week
152
 		lines = getoutput('git-rev-list --all --pretty=format:%an |grep -v ^commit |sort |uniq')
156
 		lines = getoutput('git-rev-list --all --pretty=format:%an |grep -v ^commit |sort |uniq')
153
 		return lines.split('\n')
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
 	def getTags(self):
165
 	def getTags(self):
156
 		lines = getoutput('git-show-ref --tags |cut -d/ -f3')
166
 		lines = getoutput('git-show-ref --tags |cut -d/ -f3')
157
 		return lines.split('\n')
167
 		return lines.split('\n')

+ 1
- 0
statgit.css View File

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