diff --git a/tools/atc/README b/tools/atc/README index 01277f7cac..eeba3f6833 100644 --- a/tools/atc/README +++ b/tools/atc/README @@ -14,7 +14,7 @@ elections and Summit invitations. . venv/bin/activate pip install paramiko requests pyyaml ./email_stats.py --begin - # optionally specify --end, --keyfile and --user + # optionally specify --end, --keyfile, --ref and --user DATE=`date --iso` mv out $DATE cat $DATE/*.csv | sort | uniq > $DATE/all.csv diff --git a/tools/atc/email_stats.py b/tools/atc/email_stats.py index 7698c3210f..9dd45b4d8d 100755 --- a/tools/atc/email_stats.py +++ b/tools/atc/email_stats.py @@ -188,18 +188,28 @@ def main(): optparser.add_option( '-k', '--keyfile', default='~/.ssh/id_rsa', help='SSH key (default is ~/.ssh/id_rsa)') + optparser.add_option( + '-r', '--ref', default='', + help='governance git ref (e.g. sept-2014-elections') optparser.add_option( '-u', '--user', default=os.environ['USER'], help='SSH username (default is $USER)') options, args = optparser.parse_args() - for project in get_projects(PROGRAMS_URL): + if options.ref: + programs_url = '%s?id=%s' % (PROGRAMS_URL, options.ref) + extra_atcs_url = '%s?id=%s' % (EXTRA_ATCS_URL, options.ref) + else: + programs_url = PROGRAMS_URL + extra_atcs_url = EXTRA_ATCS_URL + + for project in get_projects(programs_url): output = 'out/%s.csv' % project.split('/')[-1] project_stats(project, output, options.begin, options.end, options.keyfile, options.user) writer = csv.writer(open('out/extra-atcs.csv', 'w')) - for atc in get_extra_atcs(EXTRA_ATCS_URL): + for atc in get_extra_atcs(extra_atcs_url): try: writer.writerow([''] + list(EXTRA_ATC_RE.match(atc).groups())) except AttributeError: