[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.21-584-g1e41756

eric at webkit.org eric at webkit.org
Fri Feb 26 22:18:15 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit fc8b9ec364362073a997fe01f77bd99656a1115b
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Feb 12 00:57:30 2010 +0000

    2010-02-11  Eric Seidel  <eric at webkit.org>
    
            Reviewed by Adam Barth.
    
            Need a command to clear r+ on obsolete patches in the pending-commit queue.
            https://bugs.webkit.org/show_bug.cgi?id=34863
    
            Unfortunately our http://webkit.org/pending-commit bugzilla query is not
            smart enough to ignore obsolete patches, so bugs show up there which are
            still open, but do not have patches ready for landing on them.
            This new command "clean-pending-commit" will remove r+ from obsolete patches
            in the pending-commit list.
    
            * Scripts/test-webkitpy: Add grammar_unittest
            * Scripts/webkitpy/commands/upload.py: Add clean-pending-commit and make assign-to-committer ignore cq+'d patches.
            * Scripts/webkitpy/grammar.py: Add join_with_separators
            * Scripts/webkitpy/grammar_unittest.py: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54688 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 882e6f8..2af126a 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -2,6 +2,24 @@
 
         Reviewed by Adam Barth.
 
+        Need a command to clear r+ on obsolete patches in the pending-commit queue.
+        https://bugs.webkit.org/show_bug.cgi?id=34863
+
+        Unfortunately our http://webkit.org/pending-commit bugzilla query is not
+        smart enough to ignore obsolete patches, so bugs show up there which are
+        still open, but do not have patches ready for landing on them.
+        This new command "clean-pending-commit" will remove r+ from obsolete patches
+        in the pending-commit list.
+
+        * Scripts/test-webkitpy: Add grammar_unittest
+        * Scripts/webkitpy/commands/upload.py: Add clean-pending-commit and make assign-to-committer ignore cq+'d patches.
+        * Scripts/webkitpy/grammar.py: Add join_with_separators
+        * Scripts/webkitpy/grammar_unittest.py: Added.
+
+2010-02-11  Eric Seidel  <eric at webkit.org>
+
+        Reviewed by Adam Barth.
+
         run-chromium-webkit-tests fails random pixel tests on Mac
         https://bugs.webkit.org/show_bug.cgi?id=34862
 
diff --git a/WebKitTools/Scripts/test-webkitpy b/WebKitTools/Scripts/test-webkitpy
index ca58b50..98aee37 100755
--- a/WebKitTools/Scripts/test-webkitpy
+++ b/WebKitTools/Scripts/test-webkitpy
@@ -43,6 +43,7 @@ from webkitpy.committers_unittest import *
 from webkitpy.credentials_unittest import *
 from webkitpy.diff_parser_unittest import *
 from webkitpy.executive_unittest import *
+from webkitpy.grammar_unittest import *
 from webkitpy.multicommandtool_unittest import *
 from webkitpy.networktransaction_unittest import *
 from webkitpy.patchcollection_unittest import *
diff --git a/WebKitTools/Scripts/webkitpy/commands/upload.py b/WebKitTools/Scripts/webkitpy/commands/upload.py
index 8d23d8b..aeba134 100644
--- a/WebKitTools/Scripts/webkitpy/commands/upload.py
+++ b/WebKitTools/Scripts/webkitpy/commands/upload.py
@@ -41,7 +41,7 @@ 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
@@ -54,11 +54,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 +105,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)
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 at 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 at example.com)\nBug 77 is already assigned to foo at 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 at webkit.org", "Attachment 128 was posted by a committer and has review+, assigning to Eric Seidel for commit.")
 
diff --git a/WebKitTools/Scripts/webkitpy/grammar.py b/WebKitTools/Scripts/webkitpy/grammar.py
index 78809e0..651bbc9 100644
--- a/WebKitTools/Scripts/webkitpy/grammar.py
+++ b/WebKitTools/Scripts/webkitpy/grammar.py
@@ -43,3 +43,11 @@ def pluralize(noun, count):
     if count != 1:
         noun = plural(noun)
     return "%d %s" % (count, noun)
+
+
+def join_with_separators(list_of_strings, separator=', ', last_separator=', and '):
+    if not list_of_strings:
+        return ""
+    if len(list_of_strings) == 1:
+        return list_of_strings[0]
+    return "%s%s%s" % (separator.join(list_of_strings[:-1]), last_separator, list_of_strings[-1])
diff --git a/WebKitTools/Scripts/webkitpy/grammar_unittest.py b/WebKitTools/Scripts/webkitpy/grammar_unittest.py
new file mode 100644
index 0000000..3d8b179
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/grammar_unittest.py
@@ -0,0 +1,38 @@
+# Copyright (C) 2010 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 unittest
+from webkitpy.grammar import join_with_separators
+
+class GrammarTest(unittest.TestCase):
+
+    def test_join_with_separators(self):
+        self.assertEqual(join_with_separators(["one", "two", "three"]), "one, two, and three")
+
+if __name__ == '__main__':
+    unittest.main()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list