| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 API doc: https://developer.github.com/v3/pulls/#create-a-pull-request | 52 API doc: https://developer.github.com/v3/pulls/#create-a-pull-request |
| 53 | 53 |
| 54 Returns: | 54 Returns: |
| 55 A raw response object if successful, None if not. | 55 A raw response object if successful, None if not. |
| 56 """ | 56 """ |
| 57 assert remote_branch_name | 57 assert remote_branch_name |
| 58 assert desc_title | 58 assert desc_title |
| 59 assert body | 59 assert body |
| 60 | 60 |
| 61 # TODO(jeffcarp): CC foolip and qyearsley on all PRs for now | |
| 62 # TODO(jeffcarp): add HTTP to Host and use that here | |
| 63 path = '/repos/w3c/web-platform-tests/pulls' | 61 path = '/repos/w3c/web-platform-tests/pulls' |
| 64 body = { | 62 body = { |
| 65 "title": desc_title, | 63 "title": desc_title, |
| 66 "body": body, | 64 "body": body, |
| 67 "head": remote_branch_name, | 65 "head": remote_branch_name, |
| 68 "base": 'master', | 66 "base": 'master', |
| 69 } | 67 } |
| 70 data, status_code = self.request(path, method='POST', body=body) | 68 data, status_code = self.request(path, method='POST', body=body) |
| 71 | 69 |
| 72 if status_code != 201: | 70 if status_code != 201: |
| (...skipping 26 matching lines...) Expand all Loading... |
| 99 | 97 |
| 100 def delete_remote_branch(self, remote_branch_name): | 98 def delete_remote_branch(self, remote_branch_name): |
| 101 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 |
| 102 data, status_code = self.request(path, method='DELETE') | 100 data, status_code = self.request(path, method='DELETE') |
| 103 | 101 |
| 104 if status_code != 200: | 102 if status_code != 200: |
| 105 # TODO(jeffcarp): Raise more specific exception (create MergeError c
lass?) | 103 # TODO(jeffcarp): Raise more specific exception (create MergeError c
lass?) |
| 106 raise Exception('PR could not be merged') | 104 raise Exception('PR could not be merged') |
| 107 | 105 |
| 108 return data | 106 return data |
| OLD | NEW |