diff options
Diffstat (limited to 'Tools/Scripts/webkitpy/tool')
-rw-r--r-- | Tools/Scripts/webkitpy/tool/bot/commitqueuetask.py | 13 | ||||
-rw-r--r-- | Tools/Scripts/webkitpy/tool/commands/queues_unittest.py | 2 | ||||
-rw-r--r-- | Tools/Scripts/webkitpy/tool/commands/upload.py | 21 | ||||
-rw-r--r-- | Tools/Scripts/webkitpy/tool/commands/upload_unittest.py | 19 | ||||
-rw-r--r-- | Tools/Scripts/webkitpy/tool/steps/__init__.py | 1 | ||||
-rw-r--r-- | Tools/Scripts/webkitpy/tool/steps/abstractstep.py | 2 | ||||
-rw-r--r-- | Tools/Scripts/webkitpy/tool/steps/attachtobug.py | 51 | ||||
-rw-r--r-- | Tools/Scripts/webkitpy/tool/steps/commit.py | 2 | ||||
-rw-r--r-- | Tools/Scripts/webkitpy/tool/steps/options.py | 2 | ||||
-rw-r--r-- | Tools/Scripts/webkitpy/tool/steps/preparechangelog.py | 2 |
10 files changed, 99 insertions, 16 deletions
diff --git a/Tools/Scripts/webkitpy/tool/bot/commitqueuetask.py b/Tools/Scripts/webkitpy/tool/bot/commitqueuetask.py index b22138d..c5d9001 100644 --- a/Tools/Scripts/webkitpy/tool/bot/commitqueuetask.py +++ b/Tools/Scripts/webkitpy/tool/bot/commitqueuetask.py @@ -178,8 +178,6 @@ class CommitQueueTask(object): self._delegate.report_flaky_tests(self._patch, flaky_test_results, results_archive) def _test_patch(self): - if self._patch.is_rollout(): - return True if self._test(): return True @@ -220,12 +218,13 @@ class CommitQueueTask(object): return False if not self._apply(): return self.report_failure() - if not self._build(): - if not self._build_without_patch(): + if not self._patch.is_rollout(): + if not self._build(): + if not self._build_without_patch(): + return False + return self.report_failure() + if not self._test_patch(): return False - return self.report_failure() - if not self._test_patch(): - return False # Make sure the patch is still valid before landing (e.g., make sure # no one has set commit-queue- since we started working on the patch.) if not self._validate(): diff --git a/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py b/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py index 8f5c9e6..e2fb09f 100644 --- a/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py +++ b/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py @@ -293,8 +293,6 @@ MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'update'] MOCK: update_status: commit-queue Updated working directory MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'apply-attachment', '--no-update', '--non-interactive', 106] MOCK: update_status: commit-queue Applied patch -MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'build', '--no-clean', '--no-update', '--build-style=both'] -MOCK: update_status: commit-queue Built patch MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'land-attachment', '--force-clean', '--ignore-builders', '--non-interactive', '--parent-command=commit-queue', 106] MOCK: update_status: commit-queue Landed patch MOCK: update_status: commit-queue Pass diff --git a/Tools/Scripts/webkitpy/tool/commands/upload.py b/Tools/Scripts/webkitpy/tool/commands/upload.py index e455b18..80715a7 100644 --- a/Tools/Scripts/webkitpy/tool/commands/upload.py +++ b/Tools/Scripts/webkitpy/tool/commands/upload.py @@ -37,7 +37,7 @@ from optparse import make_option from webkitpy.tool import steps from webkitpy.common.config.committers import CommitterList -from webkitpy.common.net.bugzilla import parse_bug_id +from webkitpy.common.net.bugzilla import parse_bug_id_from_changelog from webkitpy.common.system.deprecated_logging import error, log from webkitpy.common.system.user import User from webkitpy.thirdparty.mock import Mock @@ -173,6 +173,21 @@ class ObsoleteAttachments(AbstractSequencedCommand): return { "bug_id" : args[0] } +class AttachToBug(AbstractSequencedCommand): + name = "attach-to-bug" + help_text = "Attach the the file to the bug" + argument_names = "BUGID FILEPATH" + steps = [ + steps.AttachToBug, + ] + + def _prepare_state(self, options, args, tool): + state = {} + state["bug_id"] = args[0] + state["filepath"] = args[1] + return state + + class AbstractPatchUploadingCommand(AbstractSequencedCommand): def _bug_id(self, options, args, tool, state): # Perfer a bug id passed as an argument over a bug url in the diff (i.e. ChangeLogs). @@ -311,7 +326,7 @@ class PostCommits(AbstractDeclarativeCommand): commit_message = tool.scm().commit_message_for_local_commit(commit_id) # Prefer --bug-id=, then a bug url in the commit message, then a bug url in the entire commit diff (i.e. ChangeLogs). - bug_id = options.bug_id or parse_bug_id(commit_message.message()) or parse_bug_id(tool.scm().create_patch(git_commit=commit_id)) + bug_id = options.bug_id or parse_bug_id_from_changelog(commit_message.message()) or parse_bug_id_from_changelog(tool.scm().create_patch(git_commit=commit_id)) if not bug_id: log("Skipping %s: No bug id found in commit or specified with --bug-id." % commit_id) continue @@ -351,7 +366,7 @@ class MarkBugFixed(AbstractDeclarativeCommand): commit_log = self._fetch_commit_log(tool, svn_revision) if not bug_id: - bug_id = parse_bug_id(commit_log) + bug_id = parse_bug_id_from_changelog(commit_log) if not svn_revision: match = re.search("^r(?P<svn_revision>\d+) \|", commit_log, re.MULTILINE) diff --git a/Tools/Scripts/webkitpy/tool/commands/upload_unittest.py b/Tools/Scripts/webkitpy/tool/commands/upload_unittest.py index b5f5ae9..4313df9 100644 --- a/Tools/Scripts/webkitpy/tool/commands/upload_unittest.py +++ b/Tools/Scripts/webkitpy/tool/commands/upload_unittest.py @@ -68,6 +68,25 @@ MOCK: user.open_url: http://example.com/42 """ self.assert_execute_outputs(Post(), [42], options=options, expected_stderr=expected_stderr) + def test_attach_to_bug(self): + options = MockOptions() + options.comment = "extra comment" + options.description = "file description" + expected_stderr = """MOCK add_attachment_to_bug: bug_id=42, description=file description filename=None +-- Begin comment -- +extra comment +-- End comment -- +""" + self.assert_execute_outputs(AttachToBug(), [42, "path/to/file.txt", "file description"], options=options, expected_stderr=expected_stderr) + + def test_attach_to_bug_no_description_or_comment(self): + options = MockOptions() + options.comment = None + options.description = None + expected_stderr = """MOCK add_attachment_to_bug: bug_id=42, description=file.txt filename=None +""" + self.assert_execute_outputs(AttachToBug(), [42, "path/to/file.txt"], options=options, expected_stderr=expected_stderr) + def test_land_safely(self): expected_stderr = "Obsoleting 2 old patches on bug 42\nMOCK add_patch_to_bug: bug_id=42, description=Patch for landing, mark_for_review=False, mark_for_commit_queue=False, mark_for_landing=True\n" self.assert_execute_outputs(LandSafely(), [42], expected_stderr=expected_stderr) diff --git a/Tools/Scripts/webkitpy/tool/steps/__init__.py b/Tools/Scripts/webkitpy/tool/steps/__init__.py index d5d7bb4..a746602 100644 --- a/Tools/Scripts/webkitpy/tool/steps/__init__.py +++ b/Tools/Scripts/webkitpy/tool/steps/__init__.py @@ -29,6 +29,7 @@ # FIXME: Is this the right way to do this? from webkitpy.tool.steps.applypatch import ApplyPatch from webkitpy.tool.steps.applypatchwithlocalcommit import ApplyPatchWithLocalCommit +from webkitpy.tool.steps.attachtobug import AttachToBug from webkitpy.tool.steps.build import Build from webkitpy.tool.steps.checkstyle import CheckStyle from webkitpy.tool.steps.cleanworkingdirectory import CleanWorkingDirectory diff --git a/Tools/Scripts/webkitpy/tool/steps/abstractstep.py b/Tools/Scripts/webkitpy/tool/steps/abstractstep.py index 1c93d5b..2ba4291 100644 --- a/Tools/Scripts/webkitpy/tool/steps/abstractstep.py +++ b/Tools/Scripts/webkitpy/tool/steps/abstractstep.py @@ -40,7 +40,7 @@ class AbstractStep(object): # FIXME: This should use tool.port() def _run_script(self, script_name, args=None, quiet=False, port=WebKitPort): log("Running %s" % script_name) - command = [port.script_path(script_name)] + command = port.script_shell_command(script_name) if args: command.extend(args) self._tool.executive.run_and_throw_if_fail(command, quiet) diff --git a/Tools/Scripts/webkitpy/tool/steps/attachtobug.py b/Tools/Scripts/webkitpy/tool/steps/attachtobug.py new file mode 100644 index 0000000..4885fcb --- /dev/null +++ b/Tools/Scripts/webkitpy/tool/steps/attachtobug.py @@ -0,0 +1,51 @@ +# Copyright (C) 2011 Google 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: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * 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. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT +# OWNER OR 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. + +import os + +from webkitpy.tool.steps.abstractstep import AbstractStep +from webkitpy.tool.steps.options import Options + + +class AttachToBug(AbstractStep): + @classmethod + def options(cls): + return AbstractStep.options() + [ + Options.comment, + Options.description, + ] + + def run(self, state): + filepath = state["filepath"] + bug_id = state["bug_id"] + description = self._options.description or filepath.split(os.sep)[-1] + comment_text = self._options.comment + + # add_attachment_to_bug fills in the filename from the file path. + filename = None + self._tool.bugs.add_attachment_to_bug(bug_id, filepath, description, filename, comment_text) diff --git a/Tools/Scripts/webkitpy/tool/steps/commit.py b/Tools/Scripts/webkitpy/tool/steps/commit.py index 859acbf..5dc4efb 100644 --- a/Tools/Scripts/webkitpy/tool/steps/commit.py +++ b/Tools/Scripts/webkitpy/tool/steps/commit.py @@ -58,7 +58,7 @@ class Commit(AbstractStep): try: scm = self._tool.scm() - commit_text = scm.commit_with_message(self._commit_message, git_commit=self._options.git_commit, username=username, force_squash=force_squash) + commit_text = scm.commit_with_message(self._commit_message, git_commit=self._options.git_commit, username=username, force_squash=force_squash, changed_files=self._changed_files(state)) svn_revision = scm.svn_revision_from_commit_text(commit_text) log("Committed r%s: <%s>" % (svn_revision, urls.view_revision_url(svn_revision))) self._state["commit_text"] = commit_text diff --git a/Tools/Scripts/webkitpy/tool/steps/options.py b/Tools/Scripts/webkitpy/tool/steps/options.py index 5b8baf0..3bba3e2 100644 --- a/Tools/Scripts/webkitpy/tool/steps/options.py +++ b/Tools/Scripts/webkitpy/tool/steps/options.py @@ -40,7 +40,7 @@ class Options(object): comment = make_option("--comment", action="store", type="string", dest="comment", help="Comment to post to bug.") component = make_option("--component", action="store", type="string", dest="component", help="Component for the new bug.") confirm = make_option("--no-confirm", action="store_false", dest="confirm", default=True, help="Skip confirmation steps.") - description = make_option("-m", "--description", action="store", type="string", dest="description", help="Description string for the attachment (default: \"patch\")") + description = make_option("-m", "--description", action="store", type="string", dest="description", help="Description string for the attachment") email = make_option("--email", action="store", type="string", dest="email", help="Email address to use in ChangeLogs.") 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)") force_patch = make_option("--force-patch", action="store_true", dest="force_patch", default=False, help="Forcefully applies the patch, continuing past errors.") diff --git a/Tools/Scripts/webkitpy/tool/steps/preparechangelog.py b/Tools/Scripts/webkitpy/tool/steps/preparechangelog.py index 17e996c..4be40ca 100644 --- a/Tools/Scripts/webkitpy/tool/steps/preparechangelog.py +++ b/Tools/Scripts/webkitpy/tool/steps/preparechangelog.py @@ -61,7 +61,7 @@ class PrepareChangeLog(AbstractStep): self._ensure_bug_url(state) return os.chdir(self._tool.scm().checkout_root) - args = [self._tool.port().script_path("prepare-ChangeLog")] + args = self._tool.port().script_shell_command("prepare-ChangeLog") if state.get("bug_id"): args.append("--bug=%s" % state["bug_id"]) args.append("--description=%s" % self._tool.bugs.fetch_bug(state["bug_id"]).title()) |