2009-11-28 Adam Barth <abarth@webkit.org>
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 28 Nov 2009 18:27:29 +0000 (18:27 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 28 Nov 2009 18:27:29 +0000 (18:27 +0000)
        Reviewed by Eric Seidel.

        [bzt] style-queue shouldn't reject patches from the commit-queue
        https://bugs.webkit.org/show_bug.cgi?id=31944

        Currently the style-queue subprocess gets confused and thinks its the
        commit-queue.  If the patch has an error, it rejects it from the
        commit-queue.  Instead, we should have style-queue specific logic.
        This patch doesn't add that logic, but it gives us a callback we can
        use to add that logic.

        * Scripts/modules/buildsteps.py:
        * Scripts/modules/commands/queues.py:
        * Scripts/modules/landingsequence.py:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@51460 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/Scripts/modules/buildsteps.py
WebKitTools/Scripts/modules/commands/queues.py
WebKitTools/Scripts/modules/landingsequence.py

index 90ae03a8bec52df2c2402fe05243f762777f6bc9..3552a897e2869540bc73ca66a9013378f68d16b1 100644 (file)
@@ -1,3 +1,20 @@
+2009-11-28  Adam Barth  <abarth@webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        [bzt] style-queue shouldn't reject patches from the commit-queue
+        https://bugs.webkit.org/show_bug.cgi?id=31944
+
+        Currently the style-queue subprocess gets confused and thinks its the
+        commit-queue.  If the patch has an error, it rejects it from the
+        commit-queue.  Instead, we should have style-queue specific logic.
+        This patch doesn't add that logic, but it gives us a callback we can
+        use to add that logic.
+
+        * Scripts/modules/buildsteps.py:
+        * Scripts/modules/commands/queues.py:
+        * Scripts/modules/landingsequence.py:
+
 2009-11-27  Adam Barth  <abarth@webkit.org>
 
         Rubber stamped by Eric Seidel.
index 5c50fbf80500355fbae7d7f87b2950b1d1faf435..edde38c9413d4bf564bb08e4f10fd130141a87b2 100644 (file)
@@ -49,6 +49,7 @@ class BuildSteps:
             make_option("--ignore-builders", action="store_false", dest="check_builders", default=True, help="Don't check to see if the build.webkit.org builders are green before landing."),
             make_option("--quiet", action="store_true", dest="quiet", default=False, help="Produce less console output."),
             make_option("--non-interactive", action="store_true", dest="non_interactive", default=False, help="Never prompt the user, fail as fast as possible."),
+            make_option("--parent-command", action="store", dest="parent_command", default=None, help="(Internal) The command that spawned this instance."),
         ] + WebKitPort.port_options()
 
     @staticmethod
index 918397fc573e2da6ca966c886b571558fb3a0c9f..f0540917640cda151a07b5b9b6127b573177cdf2 100644 (file)
@@ -44,7 +44,7 @@ from modules.buildbot import BuildBot
 from modules.changelogs import ChangeLog
 from modules.comments import bug_comment_from_commit_text
 from modules.grammar import pluralize
-from modules.landingsequence import LandingSequence, ConditionalLandingSequence
+from modules.landingsequence import LandingSequence, ConditionalLandingSequence, LandingSequenceErrorHandler
 from modules.logging import error, log, tee
 from modules.multicommandtool import MultiCommandTool, Command
 from modules.patchcollection import PatchCollection, PersistentPatchCollection, PersistentPatchCollectionDelegate
@@ -108,12 +108,14 @@ class AbstractQueue(Command, WorkQueueDelegate):
         work_queue.run()
 
 
-class CommitQueue(AbstractQueue):
+class CommitQueue(AbstractQueue, LandingSequenceErrorHandler):
     name = "commit-queue"
     show_in_main_help = False
     def __init__(self):
         AbstractQueue.__init__(self)
 
+    # AbstractQueue methods
+
     def begin_work_queue(self):
         AbstractQueue.begin_work_queue(self)
 
@@ -133,13 +135,19 @@ class CommitQueue(AbstractQueue):
         return (True, "Landing patch %s from bug %s." % (patch["id"], patch["bug_id"]), patch)
 
     def process_work_item(self, patch):
-        self.run_bugzilla_tool(["land-attachment", "--force-clean", "--non-interactive", "--quiet", patch["id"]])
+        self.run_bugzilla_tool(["land-attachment", "--force-clean", "--non-interactive", "--parent-command=commit-queue", "--quiet", patch["id"]])
 
     def handle_unexpected_error(self, patch, message):
         self.tool.bugs.reject_patch_from_commit_queue(patch["id"], message)
 
+    # LandingSequenceErrorHandler methods
+
+    @classmethod
+    def handle_script_error(cls, tool, patch, script_error):
+        tool.bugs.reject_patch_from_commit_queue(patch["id"], script_error.message_with_output())
 
-class AbstractTryQueue(AbstractQueue, PersistentPatchCollectionDelegate):
+
+class AbstractTryQueue(AbstractQueue, PersistentPatchCollectionDelegate, LandingSequenceErrorHandler):
     def __init__(self, options=[]):
         AbstractQueue.__init__(self, options)
 
@@ -174,6 +182,12 @@ class AbstractTryQueue(AbstractQueue, PersistentPatchCollectionDelegate):
         log(message)
         self._patches.done(patch)
 
+    # LandingSequenceErrorHandler methods
+
+    @classmethod
+    def handle_script_error(cls, tool, patch, script_error):
+        log(script_error.message_with_output())
+
 
 class StyleQueue(AbstractTryQueue):
     name = "style-queue"
@@ -185,7 +199,7 @@ class StyleQueue(AbstractTryQueue):
         return (True, "Checking style for patch %s on bug %s." % (patch["id"], patch["bug_id"]), patch)
 
     def process_work_item(self, patch):
-        self.run_bugzilla_tool(["check-style", "--force-clean", "--non-interactive", patch["id"]])
+        self.run_bugzilla_tool(["check-style", "--force-clean", "--non-interactive", "--parent-command=style-queue", patch["id"]])
         self._patches.done(patch)
 
 
@@ -208,5 +222,5 @@ class BuildQueue(AbstractTryQueue):
         return (True, "Building patch %s on bug %s." % (patch["id"], patch["bug_id"]), patch)
 
     def process_work_item(self, patch):
-        self.run_bugzilla_tool(["build-attachment", self.port.flag(), "--force-clean", "--quiet", "--no-update", patch["id"]])
+        self.run_bugzilla_tool(["build-attachment", self.port.flag(), "--force-clean", "--quiet", "--non-interactive", "--parent-command=build-queue", "--no-update", patch["id"]])
         self._patches.done(patch)
index 415dd7904b8218d9873cb4578693a4f67ef9bca7..7655eaaecee7fc41fd5cea564cdeb1bf5f7f6f8f 100644 (file)
@@ -34,6 +34,12 @@ from modules.scm import ScriptError, CheckoutNeedsUpdate
 from modules.webkitport import WebKitPort
 from modules.workqueue import WorkQueue
 
+class LandingSequenceErrorHandler():
+    @classmethod
+    def handle_script_error(cls, tool, patch, script_error):
+        raise NotImplementedError, "subclasses must implement"
+
+
 class LandingSequence:
     def __init__(self, patch, options, tool):
         self._patch = patch
@@ -61,9 +67,9 @@ class LandingSequence:
         except ScriptError, e:
             if not self._options.quiet:
                 log(e.message_with_output())
-            if self._options.non_interactive:
-                # Mark the patch as commit-queue- and comment in the bug.
-                self._tool.bugs.reject_patch_from_commit_queue(self._patch["id"], e.message_with_output())
+            if self._options.parent_command:
+                command = self._tool.command_by_name(self._options.parent_command)
+                command.handle_script_error(self._tool, self._patch, e)
             WorkQueue.exit_after_handled_error(e)
 
     def clean(self):