diff options
author | Craig Tiller <ctiller@google.com> | 2017-03-26 21:25:04 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-03-26 21:25:04 -0700 |
commit | 0fe74d35ee31ac3fb38fe647786b0b71629d64d0 (patch) | |
tree | a008cbecc2412f72fc684bf11e9fe12ccd11f716 /tools/line_count | |
parent | c4478a103b68100b86f506061cedcb0ce70016ba (diff) |
Initial historical line counter
Diffstat (limited to 'tools/line_count')
-rwxr-xr-x | tools/line_count/collect-history.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/line_count/collect-history.py b/tools/line_count/collect-history.py new file mode 100755 index 0000000000..0de95f2bac --- /dev/null +++ b/tools/line_count/collect-history.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +import subprocess +import datetime + +def daterange(start, end): + for n in range(int((end - start).days)): + yield start + datetime.timedelta(n) + +start_date = datetime.date(2014, 11, 21) +end_date = datetime.date(2017, 3, 26) + +for dt in daterange(start_date, end_date): + dmy = dt.strftime('%Y-%m-%d') + sha1 = subprocess.check_output(['git', 'rev-list', '-n', '1', + '--before=%s' % dmy, + 'master']).strip() + subprocess.check_call(['git', 'checkout', sha1]) + subprocess.check_call(['git', 'submodule', 'update']) + subprocess.check_call(['git', 'clean', '-f', '-x', '-d']) + subprocess.check_call(['cloc', '--vcs=git', '--by-file', '--yaml', '--out=../count/%s.yaml' % dmy, '.']) + |