Chromium Code Reviews| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 path = '/repos/w3c/web-platform-tests/git/refs/heads/%s' % remote_branch _name | 99 path = '/repos/w3c/web-platform-tests/git/refs/heads/%s' % remote_branch _name |
| 100 data, status_code = self.request(path, method='DELETE') | 100 data, status_code = self.request(path, method='DELETE') |
| 101 | 101 |
| 102 if status_code != 200: | 102 if status_code != 204: |
| 103 # TODO(jeffcarp): Raise more specific exception (create MergeError c lass?) | 103 # TODO(jeffcarp): Raise more specific exception (create MergeError c lass?) |
| 104 raise Exception('PR could not be merged') | 104 raise Exception('Received non-204 status code attempting to delete r emote branch: {}'.format(status_code)) |
| 105 | 105 |
| 106 return data | 106 return data |
|
qyearsley
2017/01/24 18:30:56
Note, this could probably be unit-tested by making
jeffcarp
2017/01/25 19:40:00
I'll add a TODO.
| |
| OLD | NEW |