Ignore approved changes in openreviews stats

Change-Id: I964a876f4ecf791afa810174630aa6b6fd5d8150
This commit is contained in:
Russell Bryant 2013-10-22 15:43:32 -04:00
parent 0fbcbc071c
commit 4735d47596
3 changed files with 13 additions and 9 deletions

View File

@ -67,7 +67,8 @@ def main(argv=None):
# Filter out WORKINPROGRESS # Filter out WORKINPROGRESS
continue continue
for patch_set in change['patchSets'][:-1]: for patch_set in change['patchSets'][:-1]:
if approved(patch_set) and not approved(change['patchSets'][-1]): if (utils.patch_set_approved(patch_set)
and not utils.patch_set_approved(change['patchSets'][-1])):
if has_negative_feedback(change['patchSets'][-1]): if has_negative_feedback(change['patchSets'][-1]):
continue continue
approved_and_rebased.add("%s %s" % (change['url'], approved_and_rebased.add("%s %s" % (change['url'],
@ -87,13 +88,5 @@ def has_negative_feedback(patch_set):
return False return False
def approved(patch_set):
approvals = patch_set.get('approvals', [])
for review in approvals:
if review['type'] == 'APRV':
return True
return False
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(main()) sys.exit(main())

View File

@ -323,6 +323,9 @@ def main(argv=None):
# Filter out WORKINPROGRESS # Filter out WORKINPROGRESS
continue continue
latest_patch = change['patchSets'][-1] latest_patch = change['patchSets'][-1]
if utils.patch_set_approved(latest_patch):
# Ignore patches already approved and just waiting to merge
continue
waiting_for_review = True waiting_for_review = True
approvals = latest_patch.get('approvals', []) approvals = latest_patch.get('approvals', [])
approvals.sort(key=lambda a: a['grantedOn']) approvals.sort(key=lambda a: a['grantedOn'])

View File

@ -104,3 +104,11 @@ def get_changes(projects, ssh_user, ssh_key, only_open=False,
all_changes.extend(changes) all_changes.extend(changes)
return all_changes return all_changes
def patch_set_approved(patch_set):
approvals = patch_set.get('approvals', [])
for review in approvals:
if review['type'] == 'APRV':
return True
return False