fix Stable branch maintenance

There are a couple of problems with the way Stable branch maintenance is
validated:
1. Any change in any repo, regardless of branch is accepted
2. The the key name is incorrect.  (it's 'maintenance' not 'Maintenance')

Correct the key name, and given it needs to specify the branch make it
specific to Stable branch maintenance.

Change-Id: I5d7bb4eab433766c2848c77f7cc4e1f502c0c97c
This commit is contained in:
Tony Breeds 2016-09-12 14:18:57 +10:00
parent 5295ca7a72
commit a4b6bdbd23
2 changed files with 6 additions and 2 deletions

View File

@ -36,6 +36,7 @@ def check_candidacy(change_id, limit=1, tag=utils.PROJECTS_TAG, review=None):
review = review or utils.get_reviews(change_id)[0]
owner = review.get('owner', {})
found = 0
branch = None
for filename in utils.candidate_files(review):
_, series, project_name, candidate_file = filename.split(os.sep)
@ -43,8 +44,9 @@ def check_candidacy(change_id, limit=1, tag=utils.PROJECTS_TAG, review=None):
if project_name != 'TC':
project_name = utils.dir2name(project_name, projects)
if project_name in ['Stable branch Maintenance']:
if project_name == 'Stable branch maintenance':
project_list = projects.values()
branch = '^stable/.*'
else:
project_list = [projects[project_name]]
@ -64,6 +66,8 @@ def check_candidacy(change_id, limit=1, tag=utils.PROJECTS_TAG, review=None):
(utils.gerrit_datetime(utils.PERIOD_START),
utils.gerrit_datetime(utils.PERIOD_END),
owner['email'], repo_name))
if branch:
query += (' branch:%s' % (branch))
print('Checking %s for merged changes by %s' %
(repo_name, owner['email']))
for review in utils.get_reviews(query):

View File

@ -60,7 +60,7 @@ def get_reviews(query):
opts = ['CURRENT_REVISION', 'CURRENT_FILES', 'DETAILED_ACCOUNTS']
opts_str = '&o=%s' % ('&o='.join(opts))
url = ('%s/changes/?q=%s%s' %
(GERRIT_BASE, urllib.quote_plus(query, safe='/:=><'), opts_str))
(GERRIT_BASE, urllib.quote_plus(query, safe='/:=><^.*'), opts_str))
return gerrit_query(url)