Add initial function for counting commits over time periods
This just starts at the beginning of 2014 and cranks through
This commit is contained in:
parent
c605fe7622
commit
6c78e686ee
|
@ -0,0 +1,41 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
import argparse
|
||||||
|
import datetime
|
||||||
|
import jinja2
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import teamanalysis.git
|
||||||
|
import teamanalysis.repos
|
||||||
|
import teamanalysis.time
|
||||||
|
import webbrowser
|
||||||
|
|
||||||
|
def _get_commits(repo, start, end):
|
||||||
|
abspath = '/Users/eliribble/src/{}/'.format(repo)
|
||||||
|
os.chdir(abspath)
|
||||||
|
command = [
|
||||||
|
'git',
|
||||||
|
'log',
|
||||||
|
'--pretty=format:"%h %aI"',
|
||||||
|
'--after={}'.format(start.isoformat()),
|
||||||
|
'--before={}'.format(end.isoformat())]
|
||||||
|
output = subprocess.check_output(command)
|
||||||
|
return output
|
||||||
|
|
||||||
|
def _show_summary(timepoint):
|
||||||
|
start, end = teamanalysis.time.get_checkpoint(timepoint)
|
||||||
|
results = {}
|
||||||
|
for repo in teamanalysis.repos.REPOSITORIES:
|
||||||
|
output = _get_commits(repo, start, end)
|
||||||
|
lines = output.split('\n')
|
||||||
|
results[repo] = len(lines) if output else 0
|
||||||
|
#print("{0:<30}: {1}".format(repo, results[repo]))
|
||||||
|
print("{}\t{}\t{}".format(start.date().isoformat(), end.date().isoformat(), sum(results.values())))
|
||||||
|
|
||||||
|
def main():
|
||||||
|
timepoint = datetime.datetime(2014, 1, 1, 0, 0, 1)
|
||||||
|
while timepoint < datetime.datetime.utcnow():
|
||||||
|
_show_summary(timepoint)
|
||||||
|
timepoint = timepoint + datetime.timedelta(days=7)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
Loading…
Reference in New Issue