summaryrefslogtreecommitdiffstats
path: root/WebKitTools/Scripts/webkitpy/commands
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-02-15 12:23:52 +0000
committerSteve Block <steveblock@google.com>2010-02-16 11:48:32 +0000
commit8a0914b749bbe7da7768e07a7db5c6d4bb09472b (patch)
tree73f9065f370435d6fde32ae129d458a8c77c8dff /WebKitTools/Scripts/webkitpy/commands
parentbf14be70295513b8076f3fa47a268a7e42b2c478 (diff)
downloadexternal_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.zip
external_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.tar.gz
external_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.tar.bz2
Merge webkit.org at r54731 : Initial merge by git
Change-Id: Ia79977b6cf3b0b00c06ef39419989b28e57e4f4a
Diffstat (limited to 'WebKitTools/Scripts/webkitpy/commands')
-rw-r--r--WebKitTools/Scripts/webkitpy/commands/upload.py45
-rw-r--r--WebKitTools/Scripts/webkitpy/commands/upload_unittest.py5
2 files changed, 47 insertions, 3 deletions
diff --git a/WebKitTools/Scripts/webkitpy/commands/upload.py b/WebKitTools/Scripts/webkitpy/commands/upload.py
index 8d23d8b..15bdfbb 100644
--- a/WebKitTools/Scripts/webkitpy/commands/upload.py
+++ b/WebKitTools/Scripts/webkitpy/commands/upload.py
@@ -41,10 +41,11 @@ from webkitpy.bugzilla import parse_bug_id
from webkitpy.commands.abstractsequencedcommand import AbstractSequencedCommand
from webkitpy.comments import bug_comment_from_svn_revision
from webkitpy.committers import CommitterList
-from webkitpy.grammar import pluralize
+from webkitpy.grammar import pluralize, join_with_separators
from webkitpy.webkit_logging import error, log
from webkitpy.mock import Mock
from webkitpy.multicommandtool import AbstractDeclarativeCommand
+from webkitpy.user import User
class CommitMessageForCurrentDiff(AbstractDeclarativeCommand):
name = "commit-message"
@@ -54,11 +55,45 @@ class CommitMessageForCurrentDiff(AbstractDeclarativeCommand):
os.chdir(tool.scm().checkout_root)
print "%s" % tool.scm().commit_message_for_this_commit().message()
+class CleanPendingCommit(AbstractDeclarativeCommand):
+ name = "clean-pending-commit"
+ help_text = "Clear r+ on obsolete patches so they do not appear in the pending-commit list."
+
+ # NOTE: This was designed to be generic, but right now we're only processing patches from the pending-commit list, so only r+ matters.
+ def _flags_to_clear_on_patch(self, patch):
+ if not patch.is_obsolete():
+ return None
+ what_was_cleared = []
+ if patch.review() == "+":
+ if patch.reviewer():
+ what_was_cleared.append("%s's review+" % patch.reviewer().full_name)
+ else:
+ what_was_cleared.append("review+")
+ return join_with_separators(what_was_cleared)
+
+ def execute(self, options, args, tool):
+ committers = CommitterList()
+ for bug_id in tool.bugs.queries.fetch_bug_ids_from_pending_commit_list():
+ bug = self.tool.bugs.fetch_bug(bug_id)
+ patches = bug.patches(include_obsolete=True)
+ for patch in patches:
+ flags_to_clear = self._flags_to_clear_on_patch(patch)
+ if not flags_to_clear:
+ continue
+ message = "Cleared %s from obsolete attachment %s so that this bug does not appear in http://webkit.org/pending-commit." % (flags_to_clear, patch.id())
+ self.tool.bugs.obsolete_attachment(patch.id(), message)
+
class AssignToCommitter(AbstractDeclarativeCommand):
name = "assign-to-committer"
help_text = "Assign bug to whoever attached the most recent r+'d patch"
+ def _patches_have_commiters(self, reviewed_patches):
+ for patch in reviewed_patches:
+ if not patch.committer():
+ return False
+ return True
+
def _assign_bug_to_last_patch_attacher(self, bug_id):
committers = CommitterList()
bug = self.tool.bugs.fetch_bug(bug_id)
@@ -71,6 +106,12 @@ class AssignToCommitter(AbstractDeclarativeCommand):
if not reviewed_patches:
log("Bug %s has no non-obsolete patches, ignoring." % bug_id)
return
+
+ # We only need to do anything with this bug if one of the r+'d patches does not have a valid committer (cq+ set).
+ if self._patches_have_commiters(reviewed_patches):
+ log("All reviewed patches on bug %s already have commit-queue+, ignoring." % bug_id)
+ return
+
latest_patch = reviewed_patches[-1]
attacher_email = latest_patch.attacher_email()
committer = committers.committer_by_email(attacher_email)
@@ -383,7 +424,7 @@ class CreateBug(AbstractDeclarativeCommand):
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)
def prompt_for_bug_title_and_comment(self):
- bug_title = raw_input("Bug title: ")
+ bug_title = User.prompt("Bug title: ")
print "Bug comment (hit ^D on blank line to end):"
lines = sys.stdin.readlines()
try:
diff --git a/WebKitTools/Scripts/webkitpy/commands/upload_unittest.py b/WebKitTools/Scripts/webkitpy/commands/upload_unittest.py
index 33001ac..7fa8797 100644
--- a/WebKitTools/Scripts/webkitpy/commands/upload_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/commands/upload_unittest.py
@@ -40,9 +40,12 @@ class UploadCommandsTest(CommandsTest):
expected_stdout = "Mock message\n"
self.assert_execute_outputs(CommitMessageForCurrentDiff(), [], expected_stdout=expected_stdout, tool=tool)
+ def test_clean_pending_commit(self):
+ self.assert_execute_outputs(CleanPendingCommit(), [])
+
def test_assign_to_committer(self):
tool = MockBugzillaTool()
- expected_stderr = "Bug 77 is already assigned to foo@foo.com (None).\nBug 76 has no non-obsolete patches, ignoring.\n"
+ expected_stderr = "Warning, attachment 128 on bug 42 has invalid committer (non-committer@example.com)\nBug 77 is already assigned to foo@foo.com (None).\nBug 76 has no non-obsolete patches, ignoring.\n"
self.assert_execute_outputs(AssignToCommitter(), [], expected_stderr=expected_stderr, tool=tool)
tool.bugs.reassign_bug.assert_called_with(42, "eric@webkit.org", "Attachment 128 was posted by a committer and has review+, assigning to Eric Seidel for commit.")