From 9560da6a40890d81b3df55bae047925fd67c5123 Mon Sep 17 00:00:00 2001 From: Chris Yeoh Date: Thu, 14 Nov 2013 23:45:34 +1030 Subject: [PATCH] Adds new/merge rate to reviewers information Adds more per day stats: - Changes with at least one patchset active in the time period - New changes uploaded - Changes merged - Changes abandoned - Changes left in WIP Estimation of queue growth based over the time period Change-Id: Idbedc70c19db215e627e047785238c5dc94fd4ea --- reviewers.py | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/reviewers.py b/reviewers.py index 06b7405..c5fc4e7 100755 --- a/reviewers.py +++ b/reviewers.py @@ -165,15 +165,34 @@ def main(argv=None): now_ts = calendar.timegm(now.timetuple()) patches_created = 0 + changes_created = 0 + changes_involved = 0 + changes_merged = 0 + changes_abandoned = 0 + changes_wip = 0 for project in projects: changes = utils.get_changes([project], options.user, options.key) for change in changes: + patch_for_change = False + first_patchset = True for patchset in change.get('patchSets', []): process_patchset(project, patchset, reviewers, ts) age = utils.get_age_of_patch(patchset, now_ts) if (now_ts - age) > ts: patches_created += 1 + patch_for_change = True + if first_patchset: + changes_created += 1 + first_patchset = False + if patch_for_change: + changes_involved += 1 + if change['status'] == 'MERGED': + changes_merged += 1 + elif change['status'] == 'ABANDONED': + changes_abandoned += 1 + elif change['status'] == 'WORKINPROGRESS': + changes_wip += 1 reviewers = [(v, k) for k, v in reviewers.iteritems() if k.lower() not in ('jenkins', 'smokestack')] @@ -245,6 +264,37 @@ def main(argv=None): 'New patch sets in the last %d days: %d (%.1f/day)\n' % (options.days, patches_created, float(patches_created) / options.days)) + file_obj.write( + 'Changes involved in the last %d days: %d (%.1f/day)\n' + % (options.days, changes_involved, + float(changes_involved) / options.days)) + file_obj.write( + ' New changes in the last %d days: %d (%.1f/day)\n' + % (options.days, changes_created, + float(changes_created) / options.days)) + file_obj.write( + ' Changes merged in the last %d days: %d (%.1f/day)\n' + % (options.days, changes_merged, + float(changes_merged) / options.days)) + file_obj.write( + ' Changes abandoned in the last %d days: %d (%.1f/day)\n' + % (options.days, changes_abandoned, + float(changes_abandoned) / options.days)) + file_obj.write( + (' Changes left in state WIP in the last %d days: %d ' + '(%.1f/day)\n') + % (options.days, changes_wip, + float(changes_wip) / options.days)) + queue_growth = (changes_created - changes_merged - + changes_abandoned - changes_wip) + file_obj.write( + (' Queue growth in the last %d days: %d ' + '(%.1f/day)\n') + % (options.days, queue_growth, + float(queue_growth) / options.days)) + file_obj.write( + ' Average number of patches per changeset: %.1f\n' + % (float(patches_created) / changes_involved)) file_obj.write( '\n(*) Disagreements are defined as a +1 or +2 vote on a ' \ 'patch where a core team member later gave a -1 or -2 vote' \