Diff
Modified: trunk/Tools/ChangeLog (111094 => 111095)
--- trunk/Tools/ChangeLog 2012-03-17 00:16:37 UTC (rev 111094)
+++ trunk/Tools/ChangeLog 2012-03-17 00:19:11 UTC (rev 111095)
@@ -1,3 +1,28 @@
+2012-03-16 Eric Seidel <[email protected]>
+
+ Add a land-from-url command
+ https://bugs.webkit.org/show_bug.cgi?id=81411
+
+ Reviewed by Adam Barth.
+
+ Very basic so far. The goal is to make it landing smarter
+ so that users don't have to bother to parse out the ids out of the urls.
+
+ * Scripts/webkitpy/common/config/urls.py:
+ (parse_bug_id):
+ (parse_attachment_id):
+ * Scripts/webkitpy/common/config/urls_unittest.py:
+ (URLsTest.test_parse_bug_id):
+ (URLsTest):
+ (URLsTest.test_parse_attachment_id):
+ * Scripts/webkitpy/tool/commands/download.py:
+ (ProcessURLsMixin):
+ (ProcessURLsMixin._fetch_list_of_patches_to_process):
+ (LandFromURL):
+ * Scripts/webkitpy/tool/commands/download_unittest.py:
+ (test_land_from_bug):
+ (test_land_from_url):
+
2012-03-16 Dave Tharp <[email protected]>
build-webkit launcher instructions use wrong relative path for Qt
Modified: trunk/Tools/Scripts/webkitpy/common/config/urls.py (111094 => 111095)
--- trunk/Tools/Scripts/webkitpy/common/config/urls.py 2012-03-17 00:16:37 UTC (rev 111094)
+++ trunk/Tools/Scripts/webkitpy/common/config/urls.py 2012-03-17 00:19:11 UTC (rev 111095)
@@ -43,23 +43,39 @@
chromium_lkgr_url = "http://chromium-status.appspot.com/lkgr"
contribution_guidelines = "http://webkit.org/coding/contributing.html"
-bug_server_host = "bugs.webkit.org"
+bug_server_domain = "webkit.org"
+bug_server_host = "bugs." + bug_server_domain
_bug_server_regex = "https?://%s/" % re.sub('\.', '\\.', bug_server_host)
bug_server_url = "https://%s/" % bug_server_host
bug_url_long = _bug_server_regex + r"show_bug\.cgi\?id=(?P<bug_id>\d+)(&ctype=xml)?"
-bug_url_short = r"https?\://webkit\.org/b/(?P<bug_id>\d+)"
+bug_url_short = r"https?\://%s/b/(?P<bug_id>\d+)" % bug_server_domain
+attachment_url = _bug_server_regex + r"attachment\.cgi\?id=(?P<attachment_id>\d+)(&action=""
+direct_attachment_url = r"https?://bug-(?P<bug_id>\d+)-attachments.%s/attachment\.cgi\?id=(?P<attachment_id>\d+)" % bug_server_domain
+
buildbot_url = "http://build.webkit.org"
chromium_buildbot_url = "http://build.chromium.org/p/chromium.webkit"
-def parse_bug_id(message):
- if not message:
+def parse_bug_id(string):
+ if not string:
return None
- match = re.search(bug_url_short, message)
+ match = re.search(bug_url_short, string)
if match:
return int(match.group('bug_id'))
- match = re.search(bug_url_long, message)
+ match = re.search(bug_url_long, string)
if match:
return int(match.group('bug_id'))
return None
+
+
+def parse_attachment_id(string):
+ if not string:
+ return None
+ match = re.search(attachment_url, string)
+ if match:
+ return int(match.group('attachment_id'))
+ match = re.search(direct_attachment_url, string)
+ if match:
+ return int(match.group('attachment_id'))
+ return None
Modified: trunk/Tools/Scripts/webkitpy/common/config/urls_unittest.py (111094 => 111095)
--- trunk/Tools/Scripts/webkitpy/common/config/urls_unittest.py 2012-03-17 00:16:37 UTC (rev 111094)
+++ trunk/Tools/Scripts/webkitpy/common/config/urls_unittest.py 2012-03-17 00:19:11 UTC (rev 111095)
@@ -28,7 +28,7 @@
import unittest
-from .urls import parse_bug_id
+from .urls import parse_bug_id, parse_attachment_id
class URLsTest(unittest.TestCase):
@@ -41,3 +41,14 @@
# Our url parser is super-fragile, but at least we're testing it.
self.assertEquals(None, parse_bug_id("http://www.webkit.org/b/12345"))
self.assertEquals(None, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?ctype=xml&id=12345"))
+
+ def test_parse_attachment_id(self):
+ self.assertEquals(12345, parse_attachment_id("https://bugs.webkit.org/attachment.cgi?id=12345&action=""
+ self.assertEquals(12345, parse_attachment_id("https://bugs.webkit.org/attachment.cgi?id=12345&action=""
+ self.assertEquals(12345, parse_attachment_id("https://bugs.webkit.org/attachment.cgi?id=12345&action=""
+ self.assertEquals(12345, parse_attachment_id("https://bugs.webkit.org/attachment.cgi?id=12345&action=""
+
+ # Direct attachment links are hosted from per-bug subdomains:
+ self.assertEquals(12345, parse_attachment_id("https://bug-23456-attachments.webkit.org/attachment.cgi?id=12345"))
+ # Make sure secure attachment URLs work too.
+ self.assertEquals(12345, parse_attachment_id("https://bug-23456-attachments.webkit.org/attachment.cgi?id=12345&t=Bqnsdkl9fs"))
Modified: trunk/Tools/Scripts/webkitpy/tool/commands/download.py (111094 => 111095)
--- trunk/Tools/Scripts/webkitpy/tool/commands/download.py 2012-03-17 00:16:37 UTC (rev 111094)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/download.py 2012-03-17 00:19:11 UTC (rev 111095)
@@ -202,6 +202,23 @@
return all_patches
+class ProcessURLsMixin(object):
+ def _fetch_list_of_patches_to_process(self, options, args, tool):
+ all_patches = []
+ for url in args:
+ bug_id = urls.parse_bug_id(url)
+ if bug_id:
+ patches = tool.bugs.fetch_bug(bug_id).patches()
+ log("%s found on bug %s." % (pluralize("patch", len(patches)), bug_id))
+ all_patches += patches
+
+ attachment_id = urls.parse_attachment_id(url)
+ if attachment_id:
+ all_patches += tool.bugs.fetch_attachment(attachment_id)
+
+ return all_patches
+
+
class CheckStyle(AbstractPatchSequencingCommand, ProcessAttachmentsMixin):
name = "check-style"
help_text = "Run check-webkit-style on the specified attachments"
@@ -317,6 +334,12 @@
show_in_main_help = True
+class LandFromURL(AbstractPatchLandingCommand, ProcessURLsMixin):
+ name = "land-from-url"
+ help_text = "Land all patches on the given URLs, optionally building and testing them first"
+ argument_names = "URL [URLS]"
+
+
class ValidateChangelog(AbstractSequencedCommand):
name = "validate-changelog"
help_text = "Validate that the ChangeLogs and reviewers look reasonable"
Modified: trunk/Tools/Scripts/webkitpy/tool/commands/download_unittest.py (111094 => 111095)
--- trunk/Tools/Scripts/webkitpy/tool/commands/download_unittest.py 2012-03-17 00:16:37 UTC (rev 111094)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/download_unittest.py 2012-03-17 00:19:11 UTC (rev 111095)
@@ -193,7 +193,7 @@
"""
self.assert_execute_outputs(LandAttachment(), [10000], options=self._default_options(), expected_stderr=expected_stderr)
- def test_land_patches(self):
+ def test_land_from_bug(self):
# FIXME: This expected result is imperfect, notice how it's seeing the same patch as still there after it thought it would have cleared the flags.
expected_stderr = """2 reviewed patches found on bug 50000.
Processing 2 patches from 1 bug.
@@ -220,6 +220,33 @@
"""
self.assert_execute_outputs(LandFromBug(), [50000], options=self._default_options(), expected_stderr=expected_stderr)
+ def test_land_from_url(self):
+ # FIXME: This expected result is imperfect, notice how it's seeing the same patch as still there after it thought it would have cleared the flags.
+ expected_stderr = """2 patches found on bug 50000.
+Processing 2 patches from 1 bug.
+Updating working directory
+Processing patch 10000 from bug 50000.
+Building WebKit
+Running Python unit tests
+Running Perl unit tests
+Running _javascript_Core tests
+Running WebKit unit tests
+Running run-webkit-tests
+Committed r49824: <http://trac.webkit.org/changeset/49824>
+Not closing bug 50000 as attachment 10000 has review=+. Assuming there are more patches to land from this bug.
+Updating working directory
+Processing patch 10001 from bug 50000.
+Building WebKit
+Running Python unit tests
+Running Perl unit tests
+Running _javascript_Core tests
+Running WebKit unit tests
+Running run-webkit-tests
+Committed r49824: <http://trac.webkit.org/changeset/49824>
+Not closing bug 50000 as attachment 10000 has review=+. Assuming there are more patches to land from this bug.
+"""
+ self.assert_execute_outputs(LandFromURL(), ["https://bugs.webkit.org/show_bug.cgi?id=50000"], options=self._default_options(), expected_stderr=expected_stderr)
+
def test_prepare_rollout(self):
expected_stderr = "Preparing rollout for bug 50000.\nUpdating working directory\n"
self.assert_execute_outputs(PrepareRollout(), [852, "Reason"], options=self._default_options(), expected_stderr=expected_stderr)