summaryrefslogtreecommitdiffstats
path: root/WebKitTools/Scripts/webkitpy/tool/commands
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-05-11 18:35:50 +0100
committerBen Murdoch <benm@google.com>2010-05-14 10:23:05 +0100
commit21939df44de1705786c545cd1bf519d47250322d (patch)
treeef56c310f5c0cdc379c2abb2e212308a3281ce20 /WebKitTools/Scripts/webkitpy/tool/commands
parent4ff1d8891d520763f17675827154340c7c740f90 (diff)
downloadexternal_webkit-21939df44de1705786c545cd1bf519d47250322d.zip
external_webkit-21939df44de1705786c545cd1bf519d47250322d.tar.gz
external_webkit-21939df44de1705786c545cd1bf519d47250322d.tar.bz2
Merge Webkit at r58956: Initial merge by Git.
Change-Id: I1d9fb60ea2c3f2ddc04c17a871acdb39353be228
Diffstat (limited to 'WebKitTools/Scripts/webkitpy/tool/commands')
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/commands/download.py4
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/commands/earlywarningsystem.py2
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/commands/queues.py10
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py4
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/commands/upload.py31
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/commands/upload_unittest.py4
6 files changed, 28 insertions, 27 deletions
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/download.py b/WebKitTools/Scripts/webkitpy/tool/commands/download.py
index d960bbe..c66b95c 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/download.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/download.py
@@ -89,12 +89,12 @@ class Land(AbstractSequencedCommand):
steps.CloseBugForLandDiff,
]
long_help = """land commits the current working copy diff (just as svn or git commit would).
-land will build and run the tests before committing.
+land will NOT build and run the tests before committing, but you can use the --build option for that.
If a bug id is provided, or one can be found in the ChangeLog land will update the bug after committing."""
def _prepare_state(self, options, args, tool):
return {
- "bug_id" : (args and args[0]) or tool.checkout().bug_id_for_this_commit()
+ "bug_id": (args and args[0]) or tool.checkout().bug_id_for_this_commit(options.git_commit, options.squash),
}
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/earlywarningsystem.py b/WebKitTools/Scripts/webkitpy/tool/commands/earlywarningsystem.py
index 9ea34c0..7505c62 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/earlywarningsystem.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/earlywarningsystem.py
@@ -26,8 +26,6 @@
# (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 StringIO import StringIO
-
from webkitpy.tool.commands.queues import AbstractReviewQueue
from webkitpy.common.config.committers import CommitterList
from webkitpy.common.config.ports import WebKitPort
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/queues.py b/WebKitTools/Scripts/webkitpy/tool/commands/queues.py
index f0da379..775aa44 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/queues.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/queues.py
@@ -71,8 +71,11 @@ class AbstractQueue(Command, QueueEngineDelegate):
def run_webkit_patch(self, args):
webkit_patch_args = [self.tool.path()]
# FIXME: This is a hack, we should have a more general way to pass global options.
+ # FIXME: We must always pass global options and their value in one argument
+ # because our global option code looks for the first argument which does
+ # not begin with "-" and assumes that is the command name.
webkit_patch_args += ["--status-host=%s" % self.tool.status_server.host]
- webkit_patch_args += map(str, args)
+ webkit_patch_args.extend(args)
return self.tool.executive.run_and_throw_if_fail(webkit_patch_args)
def _log_directory(self):
@@ -123,7 +126,10 @@ class AbstractQueue(Command, QueueEngineDelegate):
if is_error:
message = "Error: %s" % message
output = script_error.message_with_output(output_limit=1024*1024) # 1MB
- return tool.status_server.update_status(cls.name, message, state["patch"], StringIO(output))
+ # We pre-encode the string to a byte array before passing it
+ # to status_server, because ClientForm (part of mechanize)
+ # wants a file-like object with pre-encoded data.
+ return tool.status_server.update_status(cls.name, message, state["patch"], StringIO(output.encode("utf-8")))
class AbstractPatchQueue(AbstractQueue):
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py b/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py
index f0f7c86..16eb053 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py
@@ -75,7 +75,7 @@ class AbstractQueueTest(CommandsTest):
queue.bind_to_tool(tool)
queue.run_webkit_patch(run_args)
- expected_run_args = ["echo", "--status-host=example.com"] + map(str, run_args)
+ expected_run_args = ["echo", "--status-host=example.com"] + run_args
tool.executive.run_and_throw_if_fail.assert_called_with(expected_run_args)
def test_run_webkit_patch(self):
@@ -150,7 +150,7 @@ Warning, attachment 128 on bug 42 has invalid committer (non-committer@example.c
Warning, attachment 128 on bug 42 has invalid committer (non-committer@example.com)
1 patch in commit-queue [106]
""",
- "process_work_item": "MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'land-attachment', '--force-clean', '--build', '--test', '--non-interactive', '--ignore-builders', '--build-style=both', '--quiet', '76543']\n",
+ "process_work_item": "MOCK run_and_throw_if_fail: ['echo', '--status-host=example.com', 'land-attachment', '--force-clean', '--build', '--test', '--non-interactive', '--ignore-builders', '--build-style=both', '--quiet', 76543]\n",
}
self.assert_queue_outputs(CommitQueue(), tool=tool, work_item=rollout_patch, expected_stderr=expected_stderr)
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/upload.py b/WebKitTools/Scripts/webkitpy/tool/commands/upload.py
index bdf060a..99d45a6 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/upload.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/upload.py
@@ -30,7 +30,6 @@
import os
import re
-import StringIO
import sys
from optparse import make_option
@@ -141,16 +140,16 @@ class ObsoleteAttachments(AbstractSequencedCommand):
class AbstractPatchUploadingCommand(AbstractSequencedCommand):
- def _bug_id(self, args, tool, state):
+ 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).
bug_id = args and args[0]
if not bug_id:
- bug_id = tool.checkout().bug_id_for_this_commit()
+ bug_id = tool.checkout().bug_id_for_this_commit(options.git_commit, options.squash)
return bug_id
def _prepare_state(self, options, args, tool):
state = {}
- state["bug_id"] = self._bug_id(args, tool, state)
+ state["bug_id"] = self._bug_id(options, args, tool, state)
if not state["bug_id"]:
error("No bug id passed and no bug url found in ChangeLogs.")
return state
@@ -223,7 +222,7 @@ class Upload(AbstractPatchUploadingCommand):
def _prepare_state(self, options, args, tool):
state = {}
- state["bug_id"] = self._bug_id(args, tool, state)
+ state["bug_id"] = self._bug_id(options, args, tool, state)
return state
@@ -260,10 +259,6 @@ class PostCommits(AbstractDeclarativeCommand):
comment_text += tool.scm().files_changed_summary_for_commit(commit_id)
return comment_text
- def _diff_file_for_commit(self, tool, commit_id):
- diff = tool.scm().create_patch_from_local_commit(commit_id)
- return StringIO.StringIO(diff) # add_patch_to_bug expects a file-like object
-
def execute(self, options, args, tool):
commit_ids = tool.scm().commit_ids_from_commitish_arguments(args)
if len(commit_ids) > 10: # We could lower this limit, 10 is too many for one bug as-is.
@@ -274,7 +269,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_from_local_commit(commit_id))
+ bug_id = options.bug_id or parse_bug_id(commit_message.message()) or parse_bug_id(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
@@ -284,10 +279,10 @@ class PostCommits(AbstractDeclarativeCommand):
steps.ObsoletePatches(tool, options).run(state)
have_obsoleted_patches.add(bug_id)
- diff_file = self._diff_file_for_commit(tool, commit_id)
+ diff = tool.scm().create_patch(git_commit=commit_id)
description = options.description or commit_message.description(lstrip=True, strip_url=True)
comment_text = self._comment_text_for_commit(options, commit_message, tool, commit_id)
- tool.bugs.add_patch_to_bug(bug_id, diff_file, description, comment_text, mark_for_review=options.review, mark_for_commit_queue=options.request_commit)
+ tool.bugs.add_patch_to_bug(bug_id, diff, description, comment_text, mark_for_review=options.review, mark_for_commit_queue=options.request_commit)
# FIXME: This command needs to be brought into the modern age with steps and CommitInfo.
@@ -403,9 +398,8 @@ class CreateBug(AbstractDeclarativeCommand):
comment_text += "---\n"
comment_text += tool.scm().files_changed_summary_for_commit(commit_id)
- diff = tool.scm().create_patch_from_local_commit(commit_id)
- diff_file = StringIO.StringIO(diff) # create_bug expects a file-like object
- bug_id = tool.bugs.create_bug(bug_title, comment_text, options.component, diff_file, "Patch", cc=options.cc, mark_for_review=options.review, mark_for_commit_queue=options.request_commit)
+ diff = tool.scm().create_patch(git_commit=commit_id)
+ bug_id = tool.bugs.create_bug(bug_title, comment_text, options.component, diff, "Patch", cc=options.cc, mark_for_review=options.review, mark_for_commit_queue=options.request_commit)
if bug_id and len(commit_ids) > 1:
options.bug_id = bug_id
@@ -419,13 +413,12 @@ class CreateBug(AbstractDeclarativeCommand):
if options.prompt:
(bug_title, comment_text) = self.prompt_for_bug_title_and_comment()
else:
- commit_message = tool.checkout().commit_message_for_this_commit()
+ commit_message = tool.checkout().commit_message_for_this_commit(options.git_commit, options.squash)
bug_title = commit_message.description(lstrip=True, strip_url=True)
comment_text = commit_message.body(lstrip=True)
- diff = tool.scm().create_patch()
- diff_file = StringIO.StringIO(diff) # create_bug expects a file-like object
- bug_id = tool.bugs.create_bug(bug_title, comment_text, options.component, diff_file, "Patch", cc=options.cc, mark_for_review=options.review, mark_for_commit_queue=options.request_commit)
+ diff = tool.scm().create_patch(options.git_commit, options.squash)
+ bug_id = tool.bugs.create_bug(bug_title, comment_text, options.component, diff, "Patch", cc=options.cc, mark_for_review=options.review, mark_for_commit_queue=options.request_commit)
def prompt_for_bug_title_and_comment(self):
bug_title = User.prompt("Bug title: ")
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/upload_unittest.py b/WebKitTools/Scripts/webkitpy/tool/commands/upload_unittest.py
index 271df01..eec3751 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/upload_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/upload_unittest.py
@@ -58,6 +58,8 @@ class UploadCommandsTest(CommandsTest):
options.description = "MOCK description"
options.request_commit = False
options.review = True
+ # Rietveld upload code requires a real SCM checkout.
+ options.fancy_review = False
options.cc = None
expected_stderr = """Running check-webkit-style
MOCK: user.open_url: file://...
@@ -86,6 +88,8 @@ MOCK: user.open_url: http://example.com/42
options.description = "MOCK description"
options.request_commit = False
options.review = True
+ # Rietveld upload code requires a real SCM checkout.
+ options.fancy_review = False
options.cc = None
expected_stderr = """Running check-webkit-style
MOCK: user.open_url: file://...