Title: [246566] trunk/Tools
Revision
246566
Author
keith_mil...@apple.com
Date
2019-06-18 14:11:30 -0700 (Tue, 18 Jun 2019)

Log Message

webkit-patch should allow for a bugzilla url not just bugzilla id
https://bugs.webkit.org/show_bug.cgi?id=198972

Reviewed by Dewei Zhu.

When prompting for a bugzilla id or a new title we should also
allow for a bugzilla url.

* Scripts/webkitpy/tool/steps/promptforbugortitle.py:
(PromptForBugOrTitle.run):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (246565 => 246566)


--- trunk/Tools/ChangeLog	2019-06-18 21:02:19 UTC (rev 246565)
+++ trunk/Tools/ChangeLog	2019-06-18 21:11:30 UTC (rev 246566)
@@ -1,3 +1,16 @@
+2019-06-18  Keith Miller  <keith_mil...@apple.com>
+
+        webkit-patch should allow for a bugzilla url not just bugzilla id
+        https://bugs.webkit.org/show_bug.cgi?id=198972
+
+        Reviewed by Dewei Zhu.
+
+        When prompting for a bugzilla id or a new title we should also
+        allow for a bugzilla url.
+
+        * Scripts/webkitpy/tool/steps/promptforbugortitle.py:
+        (PromptForBugOrTitle.run):
+
 2019-06-18  David Quesada  <david_ques...@apple.com>
 
         REGRESSION: _WKDownload.OriginatingWebView and _WKDownload.CrashAfterDownloadDidFinishWhenDownloadProxyHoldsTheLastRefOnWebProcessPool failing

Modified: trunk/Tools/Scripts/webkitpy/tool/steps/promptforbugortitle.py (246565 => 246566)


--- trunk/Tools/Scripts/webkitpy/tool/steps/promptforbugortitle.py	2019-06-18 21:02:19 UTC (rev 246565)
+++ trunk/Tools/Scripts/webkitpy/tool/steps/promptforbugortitle.py	2019-06-18 21:11:30 UTC (rev 246566)
@@ -28,8 +28,9 @@
 
 from webkitpy.tool.steps.abstractstep import AbstractStep
 from webkitpy.tool.steps.options import Options
+from urlparse import urlparse
+import re
 
-
 class PromptForBugOrTitle(AbstractStep):
     @classmethod
     def options(cls):
@@ -41,12 +42,25 @@
         # No need to prompt if we alrady have the bug_id.
         if state.get("bug_id"):
             return
-        user_response = self._tool.user.prompt("Please enter a bug number or a title for a new bug:\n")
-        # If the user responds with a number, we assume it's bug number.
+        user_response = self._tool.user.prompt("Please enter a bug number/bugzilla URL or a title for a new bug:\n")
+        # If the user responds with a number or a valid bugzilla URL, we assume it's bug number.
         # Otherwise we assume it's a bug subject.
         try:
             state["bug_id"] = int(user_response)
         except ValueError as TypeError:
+            parsed_url = None
+            try:
+                parsed_url = urlparse(user_response)
+            except ValueError:
+                # urlparse can throw a value error for some strings.
+                pass
+
+            if parsed_url and re.match("bugs.webkit.org", parsed_url.netloc):
+                    match = re.match("id=(?P<bug_id>\d+)", parsed_url.query)
+                    if match:
+                        state["bug_id"] = int(match.group("bug_id"))
+                        return
+
             if not self._options.non_interactive and not self._tool.user.confirm("Are you sure you want to create a new bug?", default="n"):
                 self._exit(1)
             state["bug_title"] = user_response
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to