Changeset 220715 in webkit
- Timestamp:
- Aug 14, 2017 2:14:10 PM (7 years ago)
- Location:
- trunk/Tools
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r220711 r220715 1 2017-08-14 Daniel Bates <dabates@apple.com> 2 3 webkit-patch: Passing --no-review should submit patch to EWS by default 4 https://bugs.webkit.org/show_bug.cgi?id=148899 5 6 Reviewed by David Kilzer. 7 8 Make "webkit-patch upload --no-review" and "webkit-patch post-commits --no-review" submit 9 the patch(es) for EWS analysis by default. Add a new optional command line argument, --no-ews, 10 to these commands to not submit a non-reviewed patch(es) for EWS analysis. 11 12 Frequently I want to post a draft of a patch without review to have the EWS bots process 13 it to catch build and test breakage before I clean it up and post it for formal review. 14 Currently this requires using "webkit-patch upload --no-review --open-bug" to upload the 15 patch and open the bug in Safari so that I can click the Submit for EWS analysis button. 16 We should teach "webkit-patch upload" and "webkit-patch post-commits" how to do this. 17 18 * Scripts/webkitpy/common/net/bugzilla/bugzilla.py: 19 (Bugzilla._parse_attachment_id_from_add_patch_to_bug_response): Add helper function to 20 parse the attachment id from the response page after adding an attachment to the bug. 21 (Bugzilla.add_patch_to_bug): Modified to parse and return the attachment id from the 22 HTTP response after uploading the patch. 23 * Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py: 24 (MockBugzilla.add_patch_to_bug): Return a dummy attachment id for testing purposes. 25 * Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py: 26 (test__parse_attachment_id_from_add_patch_to_bug_response): Added. 27 * Scripts/webkitpy/tool/commands/upload.py: 28 (Upload): Add step SubmitToEWS to the list of steps when uploading a patch. 29 (PostCommits.__init__): Add --no-ews option to the list of applicable option flags for 30 this command. 31 (PostCommits.execute): Submit the patch to EWS, if applicable. 32 * Scripts/webkitpy/tool/commands/upload_unittest.py: 33 (test_upload): Set options.ews to False as the upload command expects this option 34 to be specified. 35 (test_upload_with_no_review_and_ews): Added. 36 * Scripts/webkitpy/tool/steps/__init__.py: Import module SubmitToEWS. 37 * Scripts/webkitpy/tool/steps/options.py: 38 (Options): Added command line option --no-ews (defaults: False - submit to EWS). 39 * Scripts/webkitpy/tool/steps/postdiff.py: 40 (PostDiff.options): Add --no-ews option to the list of applicable option flags for 41 this command. 42 (PostDiff.run): Submit the patch to EWS, if applicable. 43 * Scripts/webkitpy/tool/steps/submittoews.py: Added. 44 (SubmitToEWS): 45 (SubmitToEWS.options): Return an empty array as we this step does not have any command line options. 46 (SubmitToEWS.run): Submit the specified attachment ids for EWS analysis. 47 1 48 2017-08-14 Ryan Haddad <ryanhaddad@apple.com> 2 49 -
trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py
r216108 r220715 621 621 self.browser.submit() 622 622 623 @staticmethod 624 def _parse_attachment_id_from_add_patch_to_bug_response(response_html): 625 match = re.search('<title>Attachment (?P<attachment_id>\d+) added to Bug \d+</title>', response_html) 626 if match: 627 return match.group('attachment_id') 628 _log.warning('Unable to parse attachment id') 629 return None 630 623 631 # FIXME: The arguments to this function should be simplified and then 624 632 # this should be merged into add_attachment_to_bug … … 653 661 _log.info(comment_text) 654 662 self.browser['comment'] = comment_text 655 self.browser.submit() 663 response = self.browser.submit() 664 return self._parse_attachment_id_from_add_patch_to_bug_response(response.read()) 656 665 657 666 # FIXME: There has to be a more concise way to write this method. -
trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_mock.py
r174408 r220715 462 462 _log.info(comment_text) 463 463 _log.info("-- End comment --") 464 return '10001' 464 465 465 466 def add_cc_to_bug(self, bug_id, ccs): -
trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py
r214238 r220715 342 342 title_html_bugzilla_425 = "<title>Bug 101640 Submitted – Testing webkit-patch again</title>" 343 343 self.assertEqual(bugzilla._check_create_bug_response(title_html_bugzilla_425), '101640') 344 345 def test__parse_attachment_id_from_add_patch_to_bug_response(self): 346 bugzilla = Bugzilla() 347 348 title_html = '<title>Attachment 317591 added to Bug 175247</title>' 349 self.assertEqual(bugzilla._parse_attachment_id_from_add_patch_to_bug_response(title_html), '317591') 350 351 title_html = '<title>Attachment 317591; malformed</title>' 352 self.assertEqual(bugzilla._parse_attachment_id_from_add_patch_to_bug_response(title_html), None) 353 354 title_html = '<title>Attachment A added to Bug 175247</title>' 355 self.assertEqual(bugzilla._parse_attachment_id_from_add_patch_to_bug_response(title_html), None) 344 356 345 357 -
trunk/Tools/Scripts/webkitpy/tool/commands/upload.py
r220372 r220715 285 285 steps.EnsureBugIsOpenAndAssigned, 286 286 steps.PostDiff, 287 steps.SubmitToEWS, 287 288 ] 288 289 long_help = """upload uploads the current diff to bugs.webkit.org. … … 322 323 steps.Options.review, 323 324 steps.Options.request_commit, 325 steps.Options.ews, 324 326 ] 325 327 Command.__init__(self, options=options, requires_local_commits=True) … … 357 359 description = options.description or commit_message.description(lstrip=True, strip_url=True) 358 360 comment_text = self._comment_text_for_commit(options, commit_message, tool, commit_id) 359 tool.bugs.add_patch_to_bug(bug_id, diff, description, comment_text, mark_for_review=options.review, mark_for_commit_queue=options.request_commit) 361 attachment_id = tool.bugs.add_patch_to_bug(bug_id, diff, description, comment_text, mark_for_review=options.review, mark_for_commit_queue=options.request_commit) 362 363 # We only need to submit --no-review patches to EWS as patches posted for review are 364 # automatically submitted to EWS by EWSFeeder. 365 if not options.review and options.ews: 366 state = {'attachment_ids': [attachment_id]} 367 steps.SubmitToEWS(tool, options).run(state) 360 368 361 369 -
trunk/Tools/Scripts/webkitpy/tool/commands/upload_unittest.py
r220372 r220715 124 124 options.request_commit = False 125 125 options.review = True 126 options.submit_to_ews = False 126 127 options.sort_xcode_project = False 127 128 options.suggest_reviewers = False … … 132 133 MOCK add_patch_to_bug: bug_id=50000, description=MOCK description, mark_for_review=True, mark_for_commit_queue=False, mark_for_landing=False 133 134 MOCK: user.open_url: http://example.com/50000 135 """ 136 self.assert_execute_outputs(Upload(), [50000], options=options, expected_logs=expected_logs) 137 138 def test_upload_with_no_review_and_ews(self): 139 options = MockOptions() 140 options.cc = None 141 options.check_style = True 142 options.check_style_filter = None 143 options.comment = None 144 options.description = 'MOCK description' 145 options.non_interactive = False 146 options.request_commit = False 147 options.review = False 148 options.ews = True 149 options.sort_xcode_project = False 150 options.suggest_reviewers = False 151 expected_logs = """MOCK: user.open_url: file://... 152 Was that diff correct? 153 Obsoleting 2 old patches on bug 50000 154 MOCK reassign_bug: bug_id=50000, assignee=None 155 MOCK add_patch_to_bug: bug_id=50000, description=MOCK description, mark_for_review=False, mark_for_commit_queue=False, mark_for_landing=False 156 MOCK: user.open_url: http://example.com/50000 157 MOCK: submit_to_ews: 10001 134 158 """ 135 159 self.assert_execute_outputs(Upload(), [50000], options=options, expected_logs=expected_logs) -
trunk/Tools/Scripts/webkitpy/tool/steps/__init__.py
r220372 r220715 61 61 from webkitpy.tool.steps.runtests import RunTests 62 62 from webkitpy.tool.steps.sortxcodeprojectfiles import SortXcodeProjectFiles 63 from webkitpy.tool.steps.submittoews import SubmitToEWS 63 64 from webkitpy.tool.steps.suggestreviewers import SuggestReviewers 64 65 from webkitpy.tool.steps.update import Update -
trunk/Tools/Scripts/webkitpy/tool/steps/options.py
r220372 r220715 46 46 description = make_option("-m", "--description", action="store", type="string", dest="description", help="Description string for the attachment") 47 47 email = make_option("--email", action="store", type="string", dest="email", help="Email address to use in ChangeLogs.") 48 ews = make_option('--no-ews', action='store_false', dest='ews', default=True, help='Do not submit the patch to EWS for analysis (only applies when using --no-review).') 48 49 force_clean = make_option("--force-clean", action="store_true", dest="force_clean", default=False, help="Clean working directory before applying patches (removes local changes and commits)") 49 50 git_commit = make_option("-g", "--git-commit", action="store", dest="git_commit", help="Operate on a local commit. If a range, the commits are squashed into one. <ref>.... includes the working copy changes. UPSTREAM can be used for the upstream/tracking branch.") -
trunk/Tools/Scripts/webkitpy/tool/steps/postdiff.py
r202319 r220715 40 40 Options.request_commit, 41 41 Options.open_bug, 42 Options.ews, 42 43 ] 43 44 … … 48 49 bug_id = state["bug_id"] 49 50 50 self._tool.bugs.add_patch_to_bug(bug_id, diff, description, comment_text=comment_text, mark_for_review=self._options.review, mark_for_commit_queue=self._options.request_commit)51 attachment_id = self._tool.bugs.add_patch_to_bug(bug_id, diff, description, comment_text=comment_text, mark_for_review=self._options.review, mark_for_commit_queue=self._options.request_commit) 51 52 if self._options.open_bug: 52 53 self._tool.user.open_url(self._tool.bugs.bug_url_for_bug_id(bug_id)) 54 55 # We only need to submit --no-review patches to EWS as patches posted for review are 56 # automatically submitted to EWS by EWSFeeder. 57 if not self._options.review and self._options.ews: 58 state['attachment_ids'] = [attachment_id]
Note: See TracChangeset
for help on using the changeset viewer.