Lookup gerrit username and use that for looking for changes

In the situation that a candidate has registered an email address with
the Foundation and that address is a secondary address in gerrit we'll
fail to fin any validating changes.

So fix that by finding an account that matches the email address under
review and use that gerrit account for looking for change owners.

Change-Id: I588463e5527c4ebfd24dc8f0d94d56d18f5d5673
This commit is contained in:
Tony Breeds 2018-07-31 10:01:10 +10:00
parent ad2b1e4fb5
commit d7645d2a8e

View File

@ -32,6 +32,7 @@ def check_candidate(project_name, email, projects, limit=1):
found = 0 found = 0
branch = None branch = None
timeframe = utils.conf['timeframe'] timeframe = utils.conf['timeframe']
owner = utils.get_gerrit_account(email)['username']
if project_name in ['Stable branch maintenance']: if project_name in ['Stable branch maintenance']:
project_list = projects.values() project_list = projects.values()
@ -53,7 +54,7 @@ def check_candidate(project_name, email, projects, limit=1):
'owner:%s project:%s' % 'owner:%s project:%s' %
(utils.gerrit_datetime(timeframe['start']), (utils.gerrit_datetime(timeframe['start']),
utils.gerrit_datetime(timeframe['end']), utils.gerrit_datetime(timeframe['end']),
email, repo_name)) owner, repo_name))
if branch: if branch:
query += (' branch:%s' % (branch)) query += (' branch:%s' % (branch))
print('Checking %s for merged changes by %s' % print('Checking %s for merged changes by %s' %