Created
July 8, 2013 15:47
-
-
Save peterbe/5950003 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
USAGE: | |
$ git branch | branch-info.py | |
By peterbe | |
""" | |
import sys | |
import re | |
import json | |
import urllib | |
import urllib2 | |
bug_no = re.compile('\d{5,6}') | |
BZAPI_BASE_URL = 'https://api-dev.bugzilla.mozilla.org/1.3' | |
def run(): | |
branches = [x for x in sys.stdin.read().splitlines() | |
if x.strip()] | |
bugs = [] | |
map = {} | |
for branch in branches: | |
for no in bug_no.findall(branch): | |
map[branch] = no | |
url = ( | |
BZAPI_BASE_URL + '/bug?id=%s&include_fields=%s' | |
% (','.join(map.values()), 'status,id') | |
) | |
headers = { | |
'Accept': 'application/json', | |
'Content-Type': 'application/json' | |
} | |
req = urllib2.Request(url, None, headers) | |
response = urllib2.urlopen(req) | |
result = json.load(response) | |
statuses = {} | |
for each in result['bugs']: | |
statuses[str(each['id'])] = each['status'] | |
for branch in branches: | |
print branch[:75].ljust(78), | |
if branch in map: | |
no = map[branch] | |
print statuses.get(no, 'n/a') | |
else: | |
print 'n/a' | |
if __name__ == '__main__': | |
sys.exit(run()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(socorro)peterbe@mpb:~/socorro (master %>)$ git branch | branch-info.py | |
771237-upgrade-to-9.2 RESOLVED | |
814073-upgrade-to-9.2 RESOLVED | |
814647-email-every-user VERIFIED | |
bug664501-bugzilla-crontabber-app RESOLVED | |
bug664501-bugzilla-crontabber-app4 RESOLVED | |
bug701253-weekly-partitioning-cron RESOLVED | |
bug705659-refactor-storage-classes-3 RESOLVED | |
bug713927-utc-offsets RESOLVED | |
bug720738-loadDB-script RESOLVED | |
bug721907-cleanup-test-log-files RESOLVED | |
bug747461-local-vagrantfile-yaml RESOLVED | |
bug749019-crontabber1.1 RESOLVED | |
bug750748-adu-cron-job RESOLVED | |
bug751654-cleanup-reqs RESOLVED | |
bug755535-ftpscraper-cronapp2 RESOLVED | |
bug757279-mocking-properly RESOLVED | |
bug757942-bustage-test-setup RESOLVED | |
bug757942-crontabber-json-and-postgres RESOLVED | |
bug761650-dailymatviews-crontabber RESOLVED | |
bug762304-fakedata RESOLVED | |
bug773835-mobeta-cronjobs RESOLVED | |
bug779577-comments-in-multilines RESOLVED | |
bug781010-crontabber-drifting-last_success RESOLVED | |
bug799280-regression-broken-tests NEW | |
bug812320-test_slow_run_job-rounding-seconds RESOLVED | |
bug815366-porting-old-services-to-middleware_app NEW | |
bug821935-real-defaults-for-daily_url-cron-app NEW | |
bug839696-crontabber-state-middleware-fixes NEW | |
bug839697-crontabber-record-dependencies-in-crontabber-state-file RESOLVED | |
bug844547-crontabber-should-record-skips NEW | |
bug851184-job_list-smarter-order RESOLVED | |
bug854903-crontabber-nagios-errors-all-on-one-line RESOLVED | |
bug865691-crontabber-matviews-should-log-possible-output RESOLVED | |
bug889052-crashesexploitability-is-not-documented RESOLVED | |
bustage-fix-sleep-testing n/a | |
change-review-process n/a | |
collector-queued n/a | |
debugging-middleware-services-stuff n/a | |
hbase2012 n/a | |
include-url-in-ftpscrapers-httperrors n/a | |
ini-files-for-maximum-happiness-and-cake n/a | |
ini2012exaspiration n/a | |
kafka-processing n/a | |
list-jobs-printing-exception-types n/a | |
* master n/a | |
middleware2 n/a | |
mock-time.sleep-tests n/a | |
more-not-conditional-psycopg-exceptions n/a | |
new-install-doc n/a | |
peters_external_storage n/a | |
postgres2012 n/a | |
re-attempt-failing-jobs-sooner n/a | |
remove-sample-crontabber-apps n/a | |
slow-backfill-tests-fail-sometimes n/a | |
sqlalchemy-experiment n/a | |
sqlalchemy-experiment-mocking n/a | |
test-master2 n/a | |
test_crontabber_state-and-setupdb n/a | |
transaction-executor-certain-programming-errors n/a | |
vagrant-java-hbase n/a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment