|
|
|
|
|
|
109
|
DataCollector.collect(self, dir)
|
109
|
DataCollector.collect(self, dir)
|
|
110
|
|
110
|
|
|
111
|
try:
|
111
|
try:
|
|
112
|
- self.total_authors = int(getpipeoutput(('git-log', 'git-shortlog -s', 'wc -l')))
|
|
|
|
|
|
112
|
+ self.total_authors = int(getpipeoutput(['git-log', 'git-shortlog -s', 'wc -l']))
|
|
113
|
except:
|
113
|
except:
|
|
114
|
self.total_authors = 0
|
114
|
self.total_authors = 0
|
|
115
|
#self.total_lines = int(getoutput('git-ls-files -z |xargs -0 cat |wc -l'))
|
115
|
#self.total_lines = int(getoutput('git-ls-files -z |xargs -0 cat |wc -l'))
|
|
|
|
|
|
|
131
|
|
131
|
|
|
132
|
# tags
|
132
|
# tags
|
|
133
|
self.tags = {}
|
133
|
self.tags = {}
|
|
134
|
- lines = getpipeoutput((('git-show-ref --tags'),)).split('\n')
|
|
|
|
|
|
134
|
+ lines = getpipeoutput(['git-show-ref --tags']).split('\n')
|
|
135
|
for line in lines:
|
135
|
for line in lines:
|
|
136
|
if len(line) == 0:
|
136
|
if len(line) == 0:
|
|
137
|
continue
|
137
|
continue
|
|
|
|
|
|
|
141
|
(hash, tag) = splitted_str
|
141
|
(hash, tag) = splitted_str
|
|
142
|
|
142
|
|
|
143
|
tag = tag.replace('refs/tags/', '')
|
143
|
tag = tag.replace('refs/tags/', '')
|
|
144
|
- output = getpipeoutput((('git-log "%s" --pretty=format:"%%at %%an" -n 1' % hash),))
|
|
|
|
|
|
144
|
+ output = getpipeoutput(['git-log "%s" --pretty=format:"%%at %%an" -n 1' % hash])
|
|
145
|
if len(output) > 0:
|
145
|
if len(output) > 0:
|
|
146
|
parts = output.split(' ')
|
146
|
parts = output.split(' ')
|
|
147
|
stamp = 0
|
147
|
stamp = 0
|
|
|
|
|
|
|
154
|
|
154
|
|
|
155
|
# Collect revision statistics
|
155
|
# Collect revision statistics
|
|
156
|
# Outputs "<stamp> <author>"
|
156
|
# Outputs "<stamp> <author>"
|
|
157
|
- lines = getpipeoutput(('git-rev-list --pretty=format:"%at %an" HEAD', 'grep -v ^commit')).split('\n')
|
|
|
|
|
|
157
|
+ lines = getpipeoutput(['git-rev-list --pretty=format:"%at %an" HEAD', 'grep -v ^commit']).split('\n')
|
|
158
|
for line in lines:
|
158
|
for line in lines:
|
|
159
|
# linux-2.6 says "<unknown>" for one line O_o
|
159
|
# linux-2.6 says "<unknown>" for one line O_o
|
|
160
|
parts = line.split(' ')
|
160
|
parts = line.split(' ')
|
|
|
|
|
|
|
249
|
# TODO Optimize this, it's the worst bottleneck
|
249
|
# TODO Optimize this, it's the worst bottleneck
|
|
250
|
# outputs "<stamp> <files>" for each revision
|
250
|
# outputs "<stamp> <files>" for each revision
|
|
251
|
self.files_by_stamp = {} # stamp -> files
|
251
|
self.files_by_stamp = {} # stamp -> files
|
|
252
|
- lines = getpipeoutput(('git-rev-list --pretty=format:"%at %H" HEAD',
|
|
|
|
253
|
- 'grep -v ^commit')).strip().split('\n')
|
|
|
|
|
|
252
|
+ lines = getpipeoutput(['git-rev-list --pretty=format:"%at %H" HEAD', 'grep -v ^commit']).strip().split('\n')
|
|
254
|
#'sh while read line; do set $line; echo "$1 $(git-ls-tree -r "$2" |wc -l)"; done')).split('\n')
|
253
|
#'sh while read line; do set $line; echo "$1 $(git-ls-tree -r "$2" |wc -l)"; done')).split('\n')
|
|
255
|
tmp = [None] * len(lines)
|
254
|
tmp = [None] * len(lines)
|
|
256
|
for idx in xrange(len(lines)):
|
255
|
for idx in xrange(len(lines)):
|
|
257
|
(a, b) = lines[idx].split(" ")
|
256
|
(a, b) = lines[idx].split(" ")
|
|
258
|
- tmp[idx] = a + getpipeoutput(('git-ls-tree -r ' + b, 'wc -l')).strip('\n')
|
|
|
|
|
|
257
|
+ tmp[idx] = a + getpipeoutput(['git-ls-tree -r ' + b, 'wc -l']).strip('\n')
|
|
259
|
lines = tmp
|
258
|
lines = tmp
|
|
260
|
|
259
|
|
|
261
|
self.total_commits = len(lines)
|
260
|
self.total_commits = len(lines)
|
|
|
|
|
|
|
271
|
|
270
|
|
|
272
|
# extensions
|
271
|
# extensions
|
|
273
|
self.extensions = {} # extension -> files, lines
|
272
|
self.extensions = {} # extension -> files, lines
|
|
274
|
- lines = getpipeoutput(('git-ls-files',)).split('\n')
|
|
|
|
|
|
273
|
+ lines = getpipeoutput(['git-ls-files']).split('\n')
|
|
275
|
self.total_files = len(lines)
|
274
|
self.total_files = len(lines)
|
|
276
|
for line in lines:
|
275
|
for line in lines:
|
|
277
|
base = os.path.basename(line)
|
276
|
base = os.path.basename(line)
|
|
|
|
|
|
|
286
|
self.extensions[ext]['files'] += 1
|
285
|
self.extensions[ext]['files'] += 1
|
|
287
|
try:
|
286
|
try:
|
|
288
|
# Escaping could probably be improved here
|
287
|
# Escaping could probably be improved here
|
|
289
|
- self.extensions[ext]['lines'] += int(getpipeoutput(('wc -l "%s"' % line,)).split()[0])
|
|
|
|
|
|
288
|
+ self.extensions[ext]['lines'] += int(getpipeoutput(['wc -l "%s"' % line]).split()[0])
|
|
290
|
except:
|
289
|
except:
|
|
291
|
print 'Warning: Could not count lines for file "%s"' % line
|
290
|
print 'Warning: Could not count lines for file "%s"' % line
|
|
292
|
|
291
|
|
|
|
|
|
|
|
295
|
# N files changed, N insertions (+), N deletions(-)
|
294
|
# N files changed, N insertions (+), N deletions(-)
|
|
296
|
# <stamp> <author>
|
295
|
# <stamp> <author>
|
|
297
|
self.changes_by_date = {} # stamp -> { files, ins, del }
|
296
|
self.changes_by_date = {} # stamp -> { files, ins, del }
|
|
298
|
- lines = getpipeoutput(('git-log --shortstat --pretty=format:"%at %an"',)).split('\n')
|
|
|
|
|
|
297
|
+ lines = getpipeoutput(['git-log --shortstat --pretty=format:"%at %an"']).split('\n')
|
|
299
|
lines.reverse()
|
298
|
lines.reverse()
|
|
300
|
files = 0; inserted = 0; deleted = 0; total_lines = 0
|
299
|
files = 0; inserted = 0; deleted = 0; total_lines = 0
|
|
301
|
for line in lines:
|
300
|
for line in lines:
|
|
|
|
|
|
|
359
|
return datetime.datetime.fromtimestamp(self.last_commit_stamp)
|
358
|
return datetime.datetime.fromtimestamp(self.last_commit_stamp)
|
|
360
|
|
359
|
|
|
361
|
def getTags(self):
|
360
|
def getTags(self):
|
|
362
|
- lines = getpipeoutput(('git-show-ref --tags',
|
|
|
|
363
|
- 'cut -d/ -f3'))
|
|
|
|
|
|
361
|
+ lines = getpipeoutput(['git-show-ref --tags', 'cut -d/ -f3'])
|
|
364
|
return lines.split('\n')
|
362
|
return lines.split('\n')
|
|
365
|
|
363
|
|
|
366
|
def getTagDate(self, tag):
|
364
|
def getTagDate(self, tag):
|
|
|
|
|
|
|
379
|
return self.total_lines
|
377
|
return self.total_lines
|
|
380
|
|
378
|
|
|
381
|
def revToDate(self, rev):
|
379
|
def revToDate(self, rev):
|
|
382
|
- stamp = int(getpipeoutput(('git-log --pretty=format:%%at "%s" -n 1' % rev,)))
|
|
|
|
|
|
380
|
+ stamp = int(getpipeoutput(['git-log --pretty=format:%%at "%s" -n 1' % rev]))
|
|
383
|
return datetime.datetime.fromtimestamp(stamp).strftime('%Y-%m-%d')
|
381
|
return datetime.datetime.fromtimestamp(stamp).strftime('%Y-%m-%d')
|
|
384
|
|
382
|
|
|
385
|
class ReportCreator:
|
383
|
class ReportCreator:
|
|
|
|
|
|
|
806
|
os.chdir(path)
|
804
|
os.chdir(path)
|
|
807
|
files = glob.glob(path + '/*.plot')
|
805
|
files = glob.glob(path + '/*.plot')
|
|
808
|
for f in files:
|
806
|
for f in files:
|
|
809
|
- out = getpipeoutput((gnuplot_cmd + ' "%s"' % f,))
|
|
|
|
|
|
807
|
+ out = getpipeoutput([gnuplot_cmd + ' "%s"' % f])
|
|
810
|
if len(out) > 0:
|
808
|
if len(out) > 0:
|
|
811
|
print out
|
809
|
print out
|
|
812
|
|
810
|
|