report whether delegated reviewer has commented on patch

Sometimes the delegate comments without voting, and that is useful to
have when trying to decide if a patch is ready for approval.

Change-Id: I9001cbe8c8a47f4a2185b0c49a5b4aa931c6fa1a
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-12-12 11:39:33 -05:00
parent 9190e309c3
commit b43772b84b
1 changed files with 15 additions and 0 deletions

View File

@ -71,6 +71,7 @@ def query_gerrit(offset=0):
'CURRENT_COMMIT',
'LABELS',
'DETAILED_LABELS',
'MESSAGES',
],
},
headers={'Accept': 'application/json'},
@ -151,6 +152,18 @@ def has_rejected(name, review):
)
def has_commented(name, review):
desired_revision = max(
r.get('_number', -1)
for r in review.get('revisions', {}).values()
)
for msg in review.get('messages', []):
if msg.get('_revision_number', -1) != desired_revision:
continue
if msg.get('author', {}).get('name', '') == name:
return True
def all_changes():
offset = 0
while True:
@ -311,6 +324,8 @@ def get_one_status(change, delegates):
can_approve += '\nYES'
elif has_rejected(approver_name, change):
can_approve += '\nNO - delegate voted against'
elif has_commented(approver_name, change):
can_approve += '\ndelegate has commented'
elif topic in ('project-update', 'new-project'):
# https://governance.openstack.org/tc/reference/house-rules.html#other-project-team-updates