WebKit Bugzilla
Attachment 346420 Details for
Bug 188235
: If there's a radar in the changelog, webkit-patch upload/create-bug should put the radar in the bug and set InRadar
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188235-20180802144353.patch (text/plain), 10.84 KB, created by
Lucas Forschler
on 2018-08-02 14:43:53 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Lucas Forschler
Created:
2018-08-02 14:43:53 PDT
Size:
10.84 KB
patch
obsolete
>Index: Tools/ChangeLog >=================================================================== >--- Tools/ChangeLog (revision 234514) >+++ Tools/ChangeLog (working copy) >@@ -1,3 +1,24 @@ >+2018-08-02 Lucas Forschler <lforschler@apple.com> >+ >+ If there's a radar in the changelog, webkit-patch upload/create-bug should put the radar in the bug and set InRadar >+ https://bugs.webkit.org/show_bug.cgi?id=188235 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Scripts/webkitpy/common/checkout/changelog.py: >+ (ChangeLogEntry): Teach the ChangeLog tools how to parse a radar_id >+ * Scripts/webkitpy/common/checkout/changelog_unittest.py: Test out the new _parse_radar_id functionality >+ * Scripts/webkitpy/common/net/bugzilla/bugzilla.py: >+ (Bugzilla.add_keyword_to_bug): Add logic to add keywords using the changeform >+ * Scripts/webkitpy/tool/commands/upload.py: >+ (Upload): Teach the upload step how to add radar information when creating a new bug. >+ * Scripts/webkitpy/tool/steps/__init__.py: >+ * Scripts/webkitpy/tool/steps/addradar.py: Added. >+ (AddRadar): >+ (AddRadar.run): Contains the logic to add the radar information to bugzilla. >+ * Scripts/webkitpy/tool/steps/createbug.py: >+ (CreateBug.run): set a "created_new_bug" state when creating a new bugzilla bug. >+ > 2018-08-02 Dan Bernstein <mitz@apple.com> > > Fixed WebKit.AttrStyle timing out on build.webkit.org. >Index: Tools/Scripts/webkitpy/common/checkout/changelog.py >=================================================================== >--- Tools/Scripts/webkitpy/common/checkout/changelog.py (revision 234504) >+++ Tools/Scripts/webkitpy/common/checkout/changelog.py (working copy) >@@ -66,6 +66,8 @@ class ChangeLogEntry(object): > # e.g. (ChangeLogEntry.touched_functions): Added. > touched_functions_regexp = r'^\s*\((?P<function>[^)]*)\):' > >+ radar_id_regexp = r'(<?rdar:\/\/problems?\/)?(?P<radar_id>-?\d{7,})>?' >+ > # e.g. Reviewed by Darin Adler. > # (Discard everything after the first period to match more invalid lines.) > reviewed_by_regexp = r'^\s*((\w+\s+)+and\s+)?(Review|Rubber(\s*|-)stamp)(s|ed)?\s+([a-z]+\s+)*?by\s+(?P<reviewer>.*?)[\.,]?\s*$' >@@ -112,6 +114,19 @@ class ChangeLogEntry(object): > self._parse_entry() > > @classmethod >+ def _parse_radar_id(cls, text): >+ if not text: >+ return None >+ match = re.search(ChangeLogEntry.radar_id_regexp, text, re.MULTILINE | re.IGNORECASE) >+ if not match: >+ return None >+ radar_id = int(match.group('radar_id')) >+ if radar_id < 0: >+ return None >+ >+ return radar_id >+ >+ @classmethod > def _parse_reviewer_text(cls, text): > match = re.search(ChangeLogEntry.reviewed_by_regexp, text, re.MULTILINE | re.IGNORECASE) > if not match: >Index: Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py >=================================================================== >--- Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py (revision 234504) >+++ Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py (working copy) >@@ -407,6 +407,43 @@ class ChangeLogTest(unittest.TestCase): > def _contributors(self, names): > return [CommitterList().contributor_by_name(name) for name in names] > >+ def _assert_fuzzy_radar_match(self, radar_text, expected_radar_id): >+ parsed_radar_id = ChangeLogEntry._parse_radar_id(radar_text) >+ self.assertEqual(parsed_radar_id, expected_radar_id) >+ >+ def test_fuzzy_radar_match__none(self): >+ self._assert_fuzzy_radar_match(None, None) >+ self._assert_fuzzy_radar_match('', None) >+ self._assert_fuzzy_radar_match('There is no rdar link here', None) >+ self._assert_fuzzy_radar_match('There is no rdar:// link here', None) >+ self._assert_fuzzy_radar_match('There is no malformed rdar://abcd link here', None) >+ self._assert_fuzzy_radar_match('There is no malformed rdar://problem link here', None) >+ self._assert_fuzzy_radar_match('There is no malformed rdar://problem/abcdefgh link here', None) >+ self._assert_fuzzy_radar_match('There is no malformed rdar://problem/1234 link here', None) >+ >+ def test_fuzzy_radar_match_format_1(self): >+ self._assert_fuzzy_radar_match('<rdar://problem/1234567>', 1234567) >+ self._assert_fuzzy_radar_match('<rdar://problem/12345678>', 12345678) >+ self._assert_fuzzy_radar_match('<rdar://1234567>', 1234567) >+ self._assert_fuzzy_radar_match('<rdar://12345678>', 12345678) >+ >+ def test_fuzzy_radar_match_format_2(self): >+ self._assert_fuzzy_radar_match('rdar://problem/2345678', 2345678) >+ self._assert_fuzzy_radar_match('rdar://3456789', 3456789) >+ >+ def test_fuzzy_radar_match_format_3(self): >+ contents = """ >+ 2011-03-23 Ojan Vafai <ojan@chromium.org> >+ >+ Add failing result for WebKit2. All tests that require >+ focus fail on WebKit2. See https://bugs.webkit.org/show_bug.cgi?id=56988. >+ <rdar://problem/42824228> >+ >+ * platform/mac-wk2/fast/css/pseudo-any-expected.txt: Added. >+ >+ '''""" >+ self._assert_fuzzy_radar_match(contents, 42824228) >+ > def _assert_fuzzy_reviewer_match(self, reviewer_text, expected_text_list, expected_contributors): > unused, reviewer_text_list = ChangeLogEntry._parse_reviewer_text(reviewer_text) > self.assertEqual(reviewer_text_list, expected_text_list) >Index: Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py >=================================================================== >--- Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py (revision 234504) >+++ Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py (working copy) >@@ -851,6 +851,15 @@ class Bugzilla(object): > self.browser["newcc"] = ", ".join(email_address_list) > self.browser.submit() > >+ def add_keyword_to_bug(self, bug_id, keyword): >+ self.authenticate() >+ >+ _log.info("Adding %s to the keyword list for bug %s" % (keyword, bug_id)) >+ self.open_url(self.bug_url_for_bug_id(bug_id)) >+ self.browser.select_form(name="changeform") >+ self.browser["keywords"] = keyword >+ self.browser.submit() >+ > def post_comment_to_bug(self, bug_id, comment_text, cc=None): > self.authenticate() > >Index: Tools/Scripts/webkitpy/tool/commands/upload.py >=================================================================== >--- Tools/Scripts/webkitpy/tool/commands/upload.py (revision 234504) >+++ Tools/Scripts/webkitpy/tool/commands/upload.py (working copy) >@@ -285,6 +285,7 @@ class Upload(AbstractPatchUploadingComma > steps.SuggestReviewers, > steps.EnsureBugIsOpenAndAssigned, > steps.PostDiff, >+ steps.AddRadar, > steps.SubmitToEWS, > steps.WPTChangeExport, > ] >Index: Tools/Scripts/webkitpy/tool/steps/__init__.py >=================================================================== >--- Tools/Scripts/webkitpy/tool/steps/__init__.py (revision 234504) >+++ Tools/Scripts/webkitpy/tool/steps/__init__.py (working copy) >@@ -29,6 +29,7 @@ > > # FIXME: Is this the right way to do this? > from webkitpy.tool.steps.addsvnmimetypeforpng import AddSvnMimetypeForPng >+from webkitpy.tool.steps.addradar import AddRadar > from webkitpy.tool.steps.applypatch import ApplyPatch > from webkitpy.tool.steps.applypatchwithlocalcommit import ApplyPatchWithLocalCommit > from webkitpy.tool.steps.applywatchlist import ApplyWatchList >Index: Tools/Scripts/webkitpy/tool/steps/addradar.py >=================================================================== >--- Tools/Scripts/webkitpy/tool/steps/addradar.py (nonexistent) >+++ Tools/Scripts/webkitpy/tool/steps/addradar.py (working copy) >@@ -0,0 +1,53 @@ >+# Copyright (C) 2018 Apple Inc. All rights reserved. >+# >+# Redistribution and use in source and binary forms, with or without >+# modification, are permitted provided that the following conditions >+# are met: >+# 1. Redistributions of source code must retain the above copyright >+# notice, this list of conditions and the following disclaimer. >+# 2. Redistributions in binary form must reproduce the above copyright >+# notice, this list of conditions and the following disclaimer in the >+# documentation and/or other materials provided with the distribution. >+# >+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY >+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY >+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON >+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS >+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ >+from webkitpy.tool.steps.abstractstep import AbstractStep >+from webkitpy.common.checkout.changelog import * >+ >+import logging >+import re >+ >+_log = logging.getLogger(__name__) >+ >+ >+class AddRadar(AbstractStep): >+ def run(self, state): >+ bug_id = state["bug_id"] >+ keyword = "InRadar" >+ wkbi_email = ["webkit-bug-importer@group.apple.com"] >+ radar_link = None >+ >+ # Only add Radar information if we are operating on a newly created bug >+ if state.get("created_new_bug") != True: >+ return >+ >+ for changelog_path in self.cached_lookup(state, "changelogs"): >+ changelog_entry = ChangeLog(changelog_path).latest_entry() >+ radar_id = ChangeLogEntry._parse_radar_id(changelog_entry.contents()) >+ if radar_id: >+ radar_link = "<rdar://problem/{}>".format(radar_id) >+ break >+ >+ if radar_link: >+ self._tool.bugs.add_keyword_to_bug(bug_id, keyword) >+ self._tool.bugs.post_comment_to_bug(bug_id, radar_link) >+ self._tool.bugs.add_cc_to_bug(bug_id, wkbi_email) >Index: Tools/Scripts/webkitpy/tool/steps/createbug.py >=================================================================== >--- Tools/Scripts/webkitpy/tool/steps/createbug.py (revision 234504) >+++ Tools/Scripts/webkitpy/tool/steps/createbug.py (working copy) >@@ -52,6 +52,7 @@ class CreateBug(AbstractStep): > blocked_bugs = state.get("bug_id_list", []) > blocks = ", ".join(str(bug) for bug in blocked_bugs if bug) > state["bug_id"] = self._tool.bugs.create_bug(state["bug_title"], state["bug_description"], blocked=blocks, component=self._options.component, cc=cc) >+ state["created_new_bug"] = True > for blocked_bug in blocked_bugs: > if blocked_bug: > status = self._tool.bugs.fetch_bug(blocked_bug).status()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188235
:
346291
|
346420
|
346422
|
346711