Skip to content

Instantly share code, notes, and snippets.

Created May 20, 2016 16:52
Show Gist options
  • Save chkumar246/22ecfa8f5de4d98fb2a289904910dc4f to your computer and use it in GitHub Desktop.
Save chkumar246/22ecfa8f5de4d98fb2a289904910dc4f to your computer and use it in GitHub Desktop.
# Script to generate stats based on the activity on RDO Bugzilla
# during Bug Triage Day
# Autho: Chandan Kumar <>
# How to run this script
# python
import bugzilla
BZ_URL = ""
TRIAGE_DATES = [20160518]
def get_affected_bugs():
Returns a list of affected bugs in between triage dates
bz = bugzilla.Bugzilla(url=BZ_URL)
bugs = bz.query(bz.build_query(product=PRODUCT))
affected_bzs = [bug for bug in bugs if int(bug.last_change_time.value.split(':')[0].split('T')[0]) >= TRIAGE_DATES[0]]
print "%d Bugs affected on Bug Triage Day." % len(affected_bzs)
return affected_bzs
def get_closed_bugs(affected_bzs):
Get a list of closed Bugs on Bug Triage Day
closed_bzs = [bug for bug in affected_bzs if bug.status == 'CLOSED']
print "%d Bugs closed on Bug Triage Day" % len(closed_bzs)
return closed_bzs
def get_updators_on_bugtraiged(bug):
Get updator names who updated a particular bug on bug traige day
email = []
history = bug.get_history()['bugs'][-1]['history']
for i in history:
if int(i['when'].value.split(':')[0].split('T')[0]) >= 20160518:
return email
def generate_stats():
Return emails who had participated in Bug triage Day
print "Have Patience! it will take some time..."
bugs = get_affected_bugs()
closed_bugs = get_closed_bugs(bugs)
changed_bugs = list(set(bugs)-set(closed_bugs))
print "%d Bugs changed on Bug Triage Day" % len(changed_bugs)
activity = {}
for bug in changed_bugs:
activity.update({bug.weburl: get_updators_on_bugtraiged(bug)})
# print bug.weburl + " " + "Done"
emails = []
for email in activity.values():
return list(set(emails))
if __name__ == '__main__':
contributors = generate_stats()
print "%d people participated in RDO Bug Traige Day.\n" % len(contributors)
print '\n'.join(contributors)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment