diff options
author | Nigel Babu <nigelb@redhat.com> | 2017-11-30 15:31:54 +0530 |
---|---|---|
committer | Nigel Babu <nigelb@redhat.com> | 2017-11-30 15:57:26 +0530 |
commit | 57ecdf37e8c84a33af21fe78ffefb222038e4376 (patch) | |
tree | c247935de440add01aaac3e5136f104f22f09c31 /build-gluster-org/scripts | |
parent | 978a2ab96413f0ed4ce2d13a2eedd84671b48c0c (diff) |
Do not assume old reviews are in master
Change-Id: I9a4a6e578d743e0a84076772a5250baccc721c3d
Diffstat (limited to 'build-gluster-org/scripts')
-rw-r--r-- | build-gluster-org/scripts/close-old-reviews.py | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/build-gluster-org/scripts/close-old-reviews.py b/build-gluster-org/scripts/close-old-reviews.py index f4259b4..5aa4635 100644 --- a/build-gluster-org/scripts/close-old-reviews.py +++ b/build-gluster-org/scripts/close-old-reviews.py @@ -15,25 +15,22 @@ def get_change_ids(days=90, count=25): Get all the change IDs to close ''' r = requests.get('https://review.gluster.org/changes/' - '?q=status:open+age:{}days+project:glusterfs'. - format(days)) + '?q=status:open+age:{}days+project:glusterfs' + '&n={}'.format(days, count) + ) output = r.text cleaned_output = '\n'.join(output.split('\n')[1:]) parsed_output = json.loads(cleaned_output) - unique_id = [] - for item in parsed_output: - unique_id.append(item['change_id']) - oldest_reviews = unique_id[-int(count):] - return oldest_reviews + return parsed_output def close_reviews(change_ids): ''' Close the list of given change_ids ''' - for uid in change_ids: - url = ('https://review.gluster.org/a/changes/glusterfs~master~{}' - '/abandon'.format(uid)) + for change in change_ids: + url = ('https://review.gluster.org/a/changes/{}' + '/abandon'.format(change['id'])) data = { "message": "This change has not had activity in 90 days. " "We're automatically closing this change.\n" @@ -42,7 +39,7 @@ def close_reviews(change_ids): } username = os.environ.get('HTTP_USERNAME') password = os.environ.get('HTTP_PASSWORD') - print("Attempting to close review: ", uid) + print("Attempting to close review: ", change['_number']) response = requests.post(url, auth=(username, password), json=data) try: response.raise_for_status() @@ -63,9 +60,5 @@ def main(): # abandoning those reviews with a message close_reviews(change_ids) - # printing the list of abandoned reviews - print("The list of following reviews are abandoned:\n") - for change in change_ids: - print('https://review.gluster.org/#/q/', str(change)) main() |