| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 _log.info('Found %d exportable commits in Chromium:', len(exportable_com
mits)) | 87 _log.info('Found %d exportable commits in Chromium:', len(exportable_com
mits)) |
| 88 for commit in exportable_commits: | 88 for commit in exportable_commits: |
| 89 _log.info('- %s %s', commit, commit.subject()) | 89 _log.info('- %s %s', commit, commit.subject()) |
| 90 | 90 |
| 91 outbound_commit = exportable_commits[0] | 91 outbound_commit = exportable_commits[0] |
| 92 _log.info('Picking the earliest commit and creating a PR') | 92 _log.info('Picking the earliest commit and creating a PR') |
| 93 _log.info('- %s %s', outbound_commit.sha, outbound_commit.subject()) | 93 _log.info('- %s %s', outbound_commit.sha, outbound_commit.subject()) |
| 94 | 94 |
| 95 patch = outbound_commit.format_patch() | 95 patch = outbound_commit.format_patch() |
| 96 message = outbound_commit.message() | 96 message = outbound_commit.message() |
| 97 author = outbound_commit.author() |
| 97 | 98 |
| 98 if self.dry_run: | 99 if self.dry_run: |
| 99 _log.info('[dry_run] Stopping before creating PR') | 100 _log.info('[dry_run] Stopping before creating PR') |
| 100 _log.info('\n\n[dry_run] message:') | 101 _log.info('\n\n[dry_run] message:') |
| 101 _log.info(message) | 102 _log.info(message) |
| 102 _log.info('\n\n[dry_run] patch:') | 103 _log.info('\n\n[dry_run] patch:') |
| 103 _log.info(patch) | 104 _log.info(patch) |
| 104 return | 105 return |
| 105 | 106 |
| 106 remote_branch_name = self.local_wpt.create_branch_with_patch(message, pa
tch) | 107 remote_branch_name = self.local_wpt.create_branch_with_patch(message, pa
tch, author) |
| 107 | 108 |
| 108 response_data = self.wpt_github.create_pr( | 109 response_data = self.wpt_github.create_pr( |
| 109 remote_branch_name=remote_branch_name, | 110 remote_branch_name=remote_branch_name, |
| 110 desc_title=outbound_commit.subject(), | 111 desc_title=outbound_commit.subject(), |
| 111 body=outbound_commit.body()) | 112 body=outbound_commit.body()) |
| 112 | 113 |
| 113 _log.info('Create PR response: %s', response_data) | 114 _log.info('Create PR response: %s', response_data) |
| 114 | 115 |
| 115 if response_data: | 116 if response_data: |
| 116 data, status_code = self.wpt_github.add_label(response_data['number'
]) | 117 data, status_code = self.wpt_github.add_label(response_data['number'
]) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 136 def is_exportable(chromium_commit): | 137 def is_exportable(chromium_commit): |
| 137 patch = chromium_commit.format_patch() | 138 patch = chromium_commit.format_patch() |
| 138 return ( | 139 return ( |
| 139 patch | 140 patch |
| 140 and self.local_wpt.test_patch(patch) | 141 and self.local_wpt.test_patch(patch) |
| 141 and 'NOEXPORT=true' not in chromium_commit.message() | 142 and 'NOEXPORT=true' not in chromium_commit.message() |
| 142 and not chromium_commit.message().startswith('Import ') | 143 and not chromium_commit.message().startswith('Import ') |
| 143 ) | 144 ) |
| 144 | 145 |
| 145 return [c for c in chromium_commits if is_exportable(c)] | 146 return [c for c in chromium_commits if is_exportable(c)] |
| OLD | NEW |