| 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 logging | 5 import logging |
| 6 | 6 |
| 7 from webkitpy.w3c.local_wpt import LocalWPT | 7 from webkitpy.w3c.local_wpt import LocalWPT |
| 8 from webkitpy.w3c.chromium_commit import ChromiumCommit | 8 from webkitpy.w3c.chromium_commit import ChromiumCommit |
| 9 | 9 |
| 10 _log = logging.getLogger(__name__) | 10 _log = logging.getLogger(__name__) |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 local_branch_name = self.local_wpt.create_branch_with_patch(message, pat
ch) | 92 local_branch_name = self.local_wpt.create_branch_with_patch(message, pat
ch) |
| 93 | 93 |
| 94 response_data = self.wpt_github.create_pr( | 94 response_data = self.wpt_github.create_pr( |
| 95 local_branch_name=local_branch_name, | 95 local_branch_name=local_branch_name, |
| 96 desc_title=outbound_commit.subject(), | 96 desc_title=outbound_commit.subject(), |
| 97 body=outbound_commit.body()) | 97 body=outbound_commit.body()) |
| 98 | 98 |
| 99 _log.info('Create PR response: %s', response_data) | 99 _log.info('Create PR response: %s', response_data) |
| 100 | 100 |
| 101 if response_data: |
| 102 data, status_code = self.wpt_github.add_label(response_data['number'
]) |
| 103 _log.info('Add label response (status %s): %s', status_code, data) |
| 104 |
| 101 def exportable_commits_since(self, commit): | 105 def exportable_commits_since(self, commit): |
| 102 """Returns SHAs of exportable commits since `commit` in chronological or
der. | 106 """Returns SHAs of exportable commits since `commit` in chronological or
der. |
| 103 | 107 |
| 104 Args: | 108 Args: |
| 105 commit: The SHA of the Chromium commit from which this method will l
ook. | 109 commit: The SHA of the Chromium commit from which this method will l
ook. |
| 106 """ | 110 """ |
| 107 repo_root = self.host.executive.run_command([ | 111 repo_root = self.host.executive.run_command([ |
| 108 'git', 'rev-parse', '--show-toplevel' | 112 'git', 'rev-parse', '--show-toplevel' |
| 109 ]).strip() | 113 ]).strip() |
| 110 | 114 |
| 111 commits = self.host.executive.run_command([ | 115 commits = self.host.executive.run_command([ |
| 112 'git', 'rev-list', '{}..HEAD'.format(commit), '--reverse', | 116 'git', 'rev-list', '{}..HEAD'.format(commit), '--reverse', |
| 113 '--', repo_root + '/' + CHROMIUM_WPT_DIR | 117 '--', repo_root + '/' + CHROMIUM_WPT_DIR |
| 114 ]).splitlines() | 118 ]).splitlines() |
| 115 | 119 |
| 116 chromium_commits = [ChromiumCommit(self.host, sha=c) for c in commits] | 120 chromium_commits = [ChromiumCommit(self.host, sha=c) for c in commits] |
| 117 | 121 |
| 118 def is_exportable(chromium_commit): | 122 def is_exportable(chromium_commit): |
| 119 patch = chromium_commit.format_patch() | 123 patch = chromium_commit.format_patch() |
| 120 return ( | 124 return ( |
| 121 patch | 125 patch |
| 122 and self.local_wpt.test_patch(patch) | 126 and self.local_wpt.test_patch(patch) |
| 123 and 'NOEXPORT=true' not in chromium_commit.message() | 127 and 'NOEXPORT=true' not in chromium_commit.message() |
| 124 and not chromium_commit.message().startswith('Import ') | 128 and not chromium_commit.message().startswith('Import ') |
| 125 ) | 129 ) |
| 126 | 130 |
| 127 return [c for c in chromium_commits if is_exportable(c)] | 131 return [c for c in chromium_commits if is_exportable(c)] |
| OLD | NEW |