General: first and last commit dates.
This commit is contained in:
parent
d907dc28e7
commit
c881e6ec1f
2
TODO.txt
2
TODO.txt
@ -1,5 +1,6 @@
|
||||
- development statistics generator for git
|
||||
- should be as versatile as statcvs / statsvn
|
||||
- XXX optimize author's first/last rev getting
|
||||
|
||||
[Information]
|
||||
- git-log
|
||||
@ -30,6 +31,7 @@
|
||||
- show only first 10 and rest on separate page?
|
||||
- DONE (T): author, commits (%), LOC?, first commit, last commit
|
||||
- DONE (T): Developer of the Month: month, author, commits, LOC?
|
||||
- DONE (T): Author of Year
|
||||
|
||||
- Files
|
||||
- Total Files
|
||||
|
14
statgit
14
statgit
@ -96,6 +96,8 @@ class GitDataCollector(DataCollector):
|
||||
self.author_of_month = {} # month -> author -> commits
|
||||
self.author_of_year = {} # year -> author -> commits
|
||||
self.commits_by_month = {} # month -> commits
|
||||
self.first_commit_stamp = 0
|
||||
self.last_commit_stamp = 0
|
||||
|
||||
lines = getoutput('git-rev-list --pretty=format:"%at %an" HEAD |grep -v ^commit').split('\n')
|
||||
for line in lines:
|
||||
@ -103,6 +105,10 @@ class GitDataCollector(DataCollector):
|
||||
stamp = int(parts[0])
|
||||
author = ' '.join(parts[1:])
|
||||
|
||||
if self.last_commit_stamp == 0:
|
||||
self.last_commit_stamp = stamp
|
||||
self.first_commit_stamp = stamp
|
||||
|
||||
yymm = datetime.datetime.fromtimestamp(stamp).strftime('%Y-%m')
|
||||
if yymm in self.author_of_month:
|
||||
if author in self.author_of_month[yymm]:
|
||||
@ -126,8 +132,6 @@ class GitDataCollector(DataCollector):
|
||||
else:
|
||||
self.author_of_year[yy] = {}
|
||||
self.author_of_year[yy][author] = 1
|
||||
|
||||
print self.author_of_month
|
||||
|
||||
def getActivityByDayOfWeek(self):
|
||||
return self.activity_by_day_of_week
|
||||
@ -152,6 +156,12 @@ class GitDataCollector(DataCollector):
|
||||
lines = getoutput('git-rev-list --all --pretty=format:%an |grep -v ^commit |sort |uniq')
|
||||
return lines.split('\n')
|
||||
|
||||
def getFirstCommitDate(self):
|
||||
return datetime.datetime.fromtimestamp(self.first_commit_stamp)
|
||||
|
||||
def getLastCommitDate(self):
|
||||
return datetime.datetime.fromtimestamp(self.last_commit_stamp)
|
||||
|
||||
def getTags(self):
|
||||
lines = getoutput('git-show-ref --tags |cut -d/ -f3')
|
||||
return lines.split('\n')
|
||||
|
@ -21,6 +21,7 @@ dd {
|
||||
table {
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
tr {
|
||||
|
Loading…
x
Reference in New Issue
Block a user