Changeset 229600 in webkit
- Timestamp:
- Mar 14, 2018 9:11:03 AM (6 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r229599 r229600 1 2018-03-14 Brendan McLoughlin <brendan@bocoup.com> 2 3 Add label on github when exporting wpt tests to w3c/web-platform-test repo 4 https://bugs.webkit.org/show_bug.cgi?id=183575 5 6 Reviewed by Youenn Fablet. 7 8 * Scripts/webkitpy/w3c/test_exporter.py: 9 (TestExporter.make_pull_request): 10 (parse_args): 11 * Scripts/webkitpy/w3c/test_exporter_unittest.py: 12 (TestExporterTest.test_export): 13 1 14 2018-03-14 Zalan Bujtas <zalan@apple.com> 2 15 -
trunk/Tools/Scripts/webkitpy/w3c/test_exporter.py
r227740 r229600 40 40 WEBKIT_WPT_DIR = 'LayoutTests/imported/w3c/web-platform-tests' 41 41 WPT_PR_URL = "https://github.com/w3c/web-platform-tests/pull/" 42 WEBKIT_EXPORT_PR_LABEL = 'webkit-export' 42 43 43 44 … … 178 179 _log.info('Making pull request') 179 180 description = self._bugzilla.fetch_bug_dictionary(self._bug_id)["title"] 180 pr_number = self._github.create_pr(self._wpt_fork_remote + ':' + self._branch_name, self._commit_message, self._commit_message + "\n" + description) 181 if self._bug_id: 181 pr_number = self.create_wpt_pull_request(self._wpt_fork_remote + ':' + self._public_branch_name, self._commit_message, self._commit_message + "\n" + description) 182 if pr_number: 183 try: 184 self._github.add_label(pr_number, WEBKIT_EXPORT_PR_LABEL) 185 except Exception as e: 186 _log.warning(e) 187 _log.info('Could not add label "%s" to pr #%s. User "%s" may not have permission to update labels in the w3c/web-platform-test repo.' % (WEBKIT_EXPORT_PR_LABEL, pr_number, self._username)) 188 if self._bug_id and pr_number: 182 189 self._bugzilla.post_comment_to_bug(self._bug_id, "Submitted web-platform-tests pull request: " + WPT_PR_URL + str(pr_number)) 190 191 def create_wpt_pull_request(self, remote_branch_name, title, body): 192 pr_number = None 193 try: 194 pr_number = self._github.create_pr(remote_branch_name, title, body) 195 except Exception as e: 196 if e.code == 422: 197 _log.info('Unable to create a new pull request for branch "%s" because a pull request already exists. The branch has been updated and there is no further action needed.' % (remote_branch_name)) 198 else: 199 _log.warning(e) 200 _log.info('Error creating a pull request on github. Please ensure that the provided github token has the "public_repo" scope.') 201 return pr_number 183 202 184 203 def delete_local_branch(self): … … 247 266 - By default, the script will create an https remote URL that will require a password-based authentication to GitHub. If you are using an SSH key, please use the --remote-url option. 248 267 FIXME: 249 - Add a label on github issues250 268 - The script is not yet able to update an existing pull request 251 269 - Need a way to monitor the progress of the pul request so that status of all pending pull requests can be done at import time. -
trunk/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py
r227740 r229600 111 111 exporter = TestExporter(host, options, TestExporterTest.MockGit, TestExporterTest.MockBugzilla, MockWPTGitHub) 112 112 exporter.do_export() 113 self.assertEquals(exporter._github.calls, ['create_pr' ])113 self.assertEquals(exporter._github.calls, ['create_pr', 'add_label "webkit-export"']) 114 114 self.assertTrue('WebKit export' in exporter._github.pull_requests_created[0][1]) 115 115 self.assertEquals(exporter._git.calls, [ … … 132 132 'fetch bug 1234', 133 133 'post comment to bug 1234 : Submitted web-platform-tests pull request: https://github.com/w3c/web-platform-tests/pull/5678']) 134 135 def test_export_with_specific_branch(self): 136 host = TestExporterTest.MyMockHost() 137 options = parse_args(['test_exporter.py', '-g', 'HEAD', '-b', '1234', '-c', '-n', 'USER', '-t', 'TOKEN', '-bn', 'wpt-export-branch']) 138 exporter = TestExporter(host, options, TestExporterTest.MockGit, TestExporterTest.MockBugzilla, MockWPTGitHub) 139 exporter.do_export() 140 self.assertEquals(exporter._git.calls, [ 141 '/mock-checkout/WebKitBuild/w3c-tests/web-platform-tests', 142 'fetch', 143 'checkout master', 144 'reset hard origin/master', 145 'checkout new branch wpt-export-for-webkit-1234', 146 'apply_mail_patch patch.temp --exclude *-expected.txt', 147 'commit -a -m WebKit export of https://bugs.webkit.org/show_bug.cgi?id=1234', 148 'remote ', 149 'remote add USER https://USER@github.com/USER/web-platform-tests.git', 150 'remote get-url USER', 151 'push USER wpt-export-for-webkit-1234:wpt-export-branch -f', 152 'checkout master', 153 'delete branch wpt-export-for-webkit-1234', 154 'checkout master', 155 'reset hard origin/master'])
Note: See TracChangeset
for help on using the changeset viewer.