1#!/usr/bin/env python 2# Copyright 2017 gRPC authors. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16import subprocess 17import datetime 18 19# this script is only of historical interest: it's the script that was used to 20# bootstrap the dataset 21 22 23def daterange(start, end): 24 for n in range(int((end - start).days)): 25 yield start + datetime.timedelta(n) 26 27 28start_date = datetime.date(2017, 3, 26) 29end_date = datetime.date(2017, 3, 29) 30 31for dt in daterange(start_date, end_date): 32 dmy = dt.strftime('%Y-%m-%d') 33 sha1 = subprocess.check_output( 34 ['git', 'rev-list', '-n', '1', 35 '--before=%s' % dmy, 'master']).strip() 36 subprocess.check_call(['git', 'checkout', sha1]) 37 subprocess.check_call(['git', 'submodule', 'update']) 38 subprocess.check_call(['git', 'clean', '-f', '-x', '-d']) 39 subprocess.check_call([ 40 'cloc', '--vcs=git', '--by-file', '--yaml', 41 '--out=../count/%s.yaml' % dmy, '.' 42 ]) 43