|
|
@@ -174,6 +174,9 @@ class GitDataCollector(DataCollector):
|
|
174
|
174
|
self.last_active_day = None
|
|
175
|
175
|
self.active_days = 0
|
|
176
|
176
|
|
|
|
177
|
+ # timezone
|
|
|
178
|
+ self.commits_by_timezone = {} # timezone -> commits
|
|
|
179
|
+
|
|
177
|
180
|
# tags
|
|
178
|
181
|
self.tags = {}
|
|
179
|
182
|
lines = getpipeoutput(['git show-ref --tags']).split('\n')
|
|
|
@@ -213,7 +216,7 @@ class GitDataCollector(DataCollector):
|
|
213
|
216
|
|
|
214
|
217
|
# Collect revision statistics
|
|
215
|
218
|
# Outputs "<stamp> <author>"
|
|
216
|
|
- lines = getpipeoutput(['git rev-list --pretty=format:"%at %an" HEAD', 'grep -v ^commit']).split('\n')
|
|
|
219
|
+ lines = getpipeoutput(['git rev-list --pretty=format:"%at %ai %an" HEAD', 'grep -v ^commit']).split('\n')
|
|
217
|
220
|
for line in lines:
|
|
218
|
221
|
# linux-2.6 says "<unknown>" for one line O_o
|
|
219
|
222
|
parts = line.split(' ')
|
|
|
@@ -222,7 +225,8 @@ class GitDataCollector(DataCollector):
|
|
222
|
225
|
stamp = int(parts[0])
|
|
223
|
226
|
except ValueError:
|
|
224
|
227
|
stamp = 0
|
|
225
|
|
- if len(parts) > 1:
|
|
|
228
|
+ timezone = parts[3]
|
|
|
229
|
+ if len(parts) > 4:
|
|
226
|
230
|
author = ' '.join(parts[1:])
|
|
227
|
231
|
date = datetime.datetime.fromtimestamp(float(stamp))
|
|
228
|
232
|
|
|
|
@@ -331,6 +335,9 @@ class GitDataCollector(DataCollector):
|
|
331
|
335
|
self.last_active_day = yymmdd
|
|
332
|
336
|
self.active_days += 1
|
|
333
|
337
|
|
|
|
338
|
+ # timezone
|
|
|
339
|
+ self.commits_by_timezone[timezone] = self.commits_by_timezone.get(timezone, 0) + 1
|
|
|
340
|
+
|
|
334
|
341
|
# TODO Optimize this, it's the worst bottleneck
|
|
335
|
342
|
# outputs "<stamp> <files>" for each revision
|
|
336
|
343
|
self.files_by_stamp = {} # stamp -> files
|
|
|
@@ -713,6 +720,17 @@ class HTMLReportCreator(ReportCreator):
|
|
713
|
720
|
fg.write('%d %d\n' % (yy, data.commits_by_year[yy]))
|
|
714
|
721
|
fg.close()
|
|
715
|
722
|
|
|
|
723
|
+ # Commits by timezone
|
|
|
724
|
+ f.write(html_header(2, 'Commits by Timezone'))
|
|
|
725
|
+ f.write('<table><tr>')
|
|
|
726
|
+ f.write('<th>Timezone</th><th>Commits</th>')
|
|
|
727
|
+ max_commits_on_tz = max(data.commits_by_timezone.values())
|
|
|
728
|
+ for i in sorted(data.commits_by_timezone.keys(), key = lambda n : int(n)):
|
|
|
729
|
+ commits = data.commits_by_timezone[i]
|
|
|
730
|
+ r = 127 + int((float(commits) / max_commits_on_tz) * 128)
|
|
|
731
|
+ f.write('<tr><th>%s</th><td style="background-color: rgb(%d, 0, 0)">%d</td></tr>' % (i, r, commits))
|
|
|
732
|
+ f.write('</tr></table>')
|
|
|
733
|
+
|
|
716
|
734
|
f.write('</body></html>')
|
|
717
|
735
|
f.close()
|
|
718
|
736
|
|