| 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 |
| 8 import os |
| 9 import sys |
| 10 |
| 11 from webkitpy.common.system.filesystem import FileSystem |
| 12 from webkitpy.common.webkit_finder import WebKitFinder |
| 13 |
| 14 # httplib2 is part of the hermetic depot_tools install, |
| 15 # but we first need to find a path to it. |
| 16 # TODO(dglazkov): libhttp2 needs to be imported into thirdparty dir. |
| 17 # See http://crbug.com/670987 for details. |
| 18 _DEPOT_TOOLS_ROOT = WebKitFinder(FileSystem()).depot_tools_base() |
| 19 sys.path.append(os.path.join(_DEPOT_TOOLS_ROOT, 'third_party')) |
| 20 |
| 7 import httplib2 | 21 import httplib2 |
| 8 import logging | |
| 9 | 22 |
| 10 _log = logging.getLogger(__name__) | 23 _log = logging.getLogger(__name__) |
| 11 API_BASE = 'https://api.github.com' | 24 API_BASE = 'https://api.github.com' |
| 12 EXPORT_LABEL = 'chromium-export' | 25 EXPORT_LABEL = 'chromium-export' |
| 13 | 26 |
| 14 | 27 |
| 15 class WPTGitHub(object): | 28 class WPTGitHub(object): |
| 16 | 29 |
| 17 def __init__(self, host): | 30 def __init__(self, host): |
| 18 self.host = host | 31 self.host = host |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 101 |
| 89 def merge_pull_request(self, pull_request_number): | 102 def merge_pull_request(self, pull_request_number): |
| 90 path = '/repos/w3c/web-platform-tests/pulls/%d/merge' % pull_request_num
ber | 103 path = '/repos/w3c/web-platform-tests/pulls/%d/merge' % pull_request_num
ber |
| 91 body = {} | 104 body = {} |
| 92 response, content = self.request(path, body) | 105 response, content = self.request(path, body) |
| 93 | 106 |
| 94 if response['status'] == '200': | 107 if response['status'] == '200': |
| 95 return json.loads(content) | 108 return json.loads(content) |
| 96 else: | 109 else: |
| 97 raise Exception('PR could not be merged: %d' % pull_request_number) | 110 raise Exception('PR could not be merged: %d' % pull_request_number) |
| OLD | NEW |