| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import base64 | 5 import base64 |
| 6 import json | 6 import json |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 import urllib2 | 10 import urllib2 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 path = '/repos/w3c/web-platform-tests/pulls/%d/merge' % pull_request_num
ber | 89 path = '/repos/w3c/web-platform-tests/pulls/%d/merge' % pull_request_num
ber |
| 90 body = {} | 90 body = {} |
| 91 data, status_code = self.request(path, method='PUT', body=body) | 91 data, status_code = self.request(path, method='PUT', body=body) |
| 92 | 92 |
| 93 if status_code == 200: | 93 if status_code == 200: |
| 94 return data | 94 return data |
| 95 else: | 95 else: |
| 96 raise Exception('PR could not be merged: %d' % pull_request_number) | 96 raise Exception('PR could not be merged: %d' % pull_request_number) |
| 97 | 97 |
| 98 def delete_remote_branch(self, remote_branch_name): | 98 def delete_remote_branch(self, remote_branch_name): |
| 99 # TODO(jeffcarp): Unit test this method |
| 99 path = '/repos/w3c/web-platform-tests/git/refs/heads/%s' % remote_branch
_name | 100 path = '/repos/w3c/web-platform-tests/git/refs/heads/%s' % remote_branch
_name |
| 100 data, status_code = self.request(path, method='DELETE') | 101 data, status_code = self.request(path, method='DELETE') |
| 101 | 102 |
| 102 if status_code != 200: | 103 if status_code != 204: |
| 103 # TODO(jeffcarp): Raise more specific exception (create MergeError c
lass?) | 104 # TODO(jeffcarp): Raise more specific exception (create MergeError c
lass?) |
| 104 raise Exception('PR could not be merged') | 105 raise Exception('Received non-204 status code attempting to delete r
emote branch: {}'.format(status_code)) |
| 105 | 106 |
| 106 return data | 107 return data |
| OLD | NEW |