aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/line_count/collect-history.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/line_count/collect-history.py')
-rwxr-xr-xtools/line_count/collect-history.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/tools/line_count/collect-history.py b/tools/line_count/collect-history.py
index 3f030fbb8f..d2d5c95705 100755
--- a/tools/line_count/collect-history.py
+++ b/tools/line_count/collect-history.py
@@ -19,20 +19,23 @@ import datetime
# this script is only of historical interest: it's the script that was used to
# bootstrap the dataset
+
def daterange(start, end):
- for n in range(int((end - start).days)):
- yield start + datetime.timedelta(n)
+ for n in range(int((end - start).days)):
+ yield start + datetime.timedelta(n)
+
start_date = datetime.date(2017, 3, 26)
end_date = datetime.date(2017, 3, 29)
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, '.'])
-
+ 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, '.'
+ ])