Ignore approved changes in openreviews stats
Change-Id: I964a876f4ecf791afa810174630aa6b6fd5d8150
This commit is contained in:
parent
0fbcbc071c
commit
4735d47596
@ -67,7 +67,8 @@ def main(argv=None):
|
||||
# Filter out WORKINPROGRESS
|
||||
continue
|
||||
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]):
|
||||
continue
|
||||
approved_and_rebased.add("%s %s" % (change['url'],
|
||||
@ -87,13 +88,5 @@ def has_negative_feedback(patch_set):
|
||||
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__':
|
||||
sys.exit(main())
|
||||
|
@ -323,6 +323,9 @@ def main(argv=None):
|
||||
# Filter out WORKINPROGRESS
|
||||
continue
|
||||
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
|
||||
approvals = latest_patch.get('approvals', [])
|
||||
approvals.sort(key=lambda a: a['grantedOn'])
|
||||
|
8
utils.py
8
utils.py
@ -104,3 +104,11 @@ def get_changes(projects, ssh_user, ssh_key, only_open=False,
|
||||
all_changes.extend(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
|
||||
|
Loading…
Reference in New Issue
Block a user