From a4b6bdbd232148ada1a754c77dba364cdfab3522 Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Mon, 12 Sep 2016 14:18:57 +1000 Subject: [PATCH] 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 --- openstack_election/check_candidacy.py | 6 +++++- openstack_election/utils.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/openstack_election/check_candidacy.py b/openstack_election/check_candidacy.py index 6d26dd55..50bb76b9 100755 --- a/openstack_election/check_candidacy.py +++ b/openstack_election/check_candidacy.py @@ -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): diff --git a/openstack_election/utils.py b/openstack_election/utils.py index bda1baea..1f04a037 100644 --- a/openstack_election/utils.py +++ b/openstack_election/utils.py @@ -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)