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

        [bzt] Kill WebKitLandingScripts
        https://bugs.webkit.org/show_bug.cgi?id=31904

        Step 6: Kill the rest.

        * Scripts/modules/buildsteps.py:
        * Scripts/modules/commands/download.py:
        * Scripts/modules/commands/queries.py:
        * Scripts/modules/commands/upload.py:
        * Scripts/modules/landingsequence.py:
        * Scripts/modules/scm.py:
        * Scripts/modules/webkitlandingscripts.py: Removed.

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

WebKitTools/ChangeLog
WebKitTools/Scripts/modules/buildsteps.py
WebKitTools/Scripts/modules/commands/download.py
WebKitTools/Scripts/modules/commands/queries.py
WebKitTools/Scripts/modules/commands/upload.py
WebKitTools/Scripts/modules/landingsequence.py
WebKitTools/Scripts/modules/scm.py
WebKitTools/Scripts/modules/webkitlandingscripts.py [deleted file]

index f9f85b27392b2c039474d64effc7c23fc051b9d9..27df7d3009bc8f8ed0cb237811877afebacde01f 100644 (file)
@@ -1,3 +1,20 @@
+2009-11-27  Adam Barth  <abarth@webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        [bzt] Kill WebKitLandingScripts
+        https://bugs.webkit.org/show_bug.cgi?id=31904
+
+        Step 6: Kill the rest.
+
+        * Scripts/modules/buildsteps.py:
+        * Scripts/modules/commands/download.py:
+        * Scripts/modules/commands/queries.py:
+        * Scripts/modules/commands/upload.py:
+        * Scripts/modules/landingsequence.py:
+        * Scripts/modules/scm.py:
+        * Scripts/modules/webkitlandingscripts.py: Removed.
+
 2009-11-27  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Eric Seidel.
index 07dc63d3b6482ff2be7bddc078947f5bdac87d02..5c50fbf80500355fbae7d7f87b2950b1d1faf435 100644 (file)
 
 import os
 
+from optparse import make_option
+
 from modules.logging import log, error
 from modules.processutils import run_and_throw_if_fail
-from modules.webkitlandingscripts import WebKitLandingScripts
 from modules.webkitport import WebKitPort
 
 class BuildSteps:
+    # FIXME: The options should really live on each "Step" object.
+    @staticmethod
+    def cleaning_options():
+        return [
+            make_option("--force-clean", action="store_true", dest="force_clean", default=False, help="Clean working directory before applying patches (removes local changes and commits)"),
+            make_option("--no-clean", action="store_false", dest="clean", default=True, help="Don't check if the working directory is clean before applying patches"),
+        ]
+
+    @staticmethod
+    def build_options():
+        return [
+            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."),
+        ] + WebKitPort.port_options()
+
+    @staticmethod
+    def land_options():
+        return [
+            make_option("--no-update", action="store_false", dest="update", default=True, help="Don't update the working directory."),
+            make_option("--no-build", action="store_false", dest="build", default=True, help="Commit without building first, implies --no-test."),
+            make_option("--no-test", action="store_false", dest="test", default=True, help="Commit without running run-webkit-tests."),
+            make_option("--no-close", action="store_false", dest="close_bug", default=True, help="Leave bug open after landing."),
+        ]
+
     def _run_script(cls, script_name, quiet=False, port=WebKitPort):
         log("Running %s" % script_name)
         run_and_throw_if_fail(port.script_path(script_name), quiet)
index d986e2881dd37e9e35d432d22253341fd5188cf7..98a8ebbaa821a6db74b1b258f6a46543160f5ee6 100644 (file)
@@ -41,6 +41,7 @@ from optparse import make_option
 
 from modules.bugzilla import Bugzilla, parse_bug_id
 from modules.buildbot import BuildBot
+from modules.buildsteps import BuildSteps
 from modules.changelogs import ChangeLog
 from modules.comments import bug_comment_from_commit_text
 from modules.grammar import pluralize
@@ -50,7 +51,6 @@ from modules.multicommandtool import MultiCommandTool, Command
 from modules.patchcollection import PatchCollection
 from modules.scm import CommitMessage, detect_scm_system, ScriptError, CheckoutNeedsUpdate
 from modules.statusbot import StatusBot
-from modules.webkitlandingscripts import WebKitLandingScripts, commit_message_for_this_commit
 from modules.webkitport import WebKitPort
 from modules.workqueue import WorkQueue, WorkQueueDelegate
 
@@ -69,9 +69,9 @@ class Build(Command):
     name = "build"
     show_in_main_help = False
     def __init__(self):
-        options = WebKitLandingScripts.cleaning_options()
-        options += WebKitLandingScripts.build_options()
-        options += WebKitLandingScripts.land_options()
+        options = BuildSteps.cleaning_options()
+        options += BuildSteps.build_options()
+        options += BuildSteps.land_options()
         Command.__init__(self, "Update working copy and build", "", options)
 
     def execute(self, options, args, tool):
@@ -83,7 +83,8 @@ class ApplyAttachment(Command):
     name = "apply-attachment"
     show_in_main_help = True
     def __init__(self):
-        options = WebKitApplyingScripts.apply_options() + WebKitLandingScripts.cleaning_options()
+        options = WebKitApplyingScripts.apply_options()
+        options += BuildSteps.cleaning_options()
         Command.__init__(self, "Apply an attachment to the local working directory", "ATTACHMENT_ID", options=options)
 
     def execute(self, options, args, tool):
@@ -97,7 +98,8 @@ class ApplyPatches(Command):
     name = "apply-patches"
     show_in_main_help = True
     def __init__(self):
-        options = WebKitApplyingScripts.apply_options() + WebKitLandingScripts.cleaning_options()
+        options = WebKitApplyingScripts.apply_options()
+        options += BuildSteps.cleaning_options()
         Command.__init__(self, "Apply reviewed patches from provided bugs to the local working directory", "BUGID", options=options)
 
     def execute(self, options, args, tool):
@@ -130,7 +132,7 @@ class WebKitApplyingScripts:
             log("Applying attachment %s from bug %s" % (patch["id"], patch["bug_id"]))
             scm.apply_patch(patch)
             if options.local_commit:
-                commit_message = commit_message_for_this_commit(scm)
+                commit_message = scm.commit_message_for_this_commit()
                 scm.commit_locally_with_message(commit_message.message() or patch["name"])
 
 
@@ -167,8 +169,8 @@ class LandDiff(Command):
         options = [
             make_option("-r", "--reviewer", action="store", type="string", dest="reviewer", help="Update ChangeLogs to say Reviewed by REVIEWER."),
         ]
-        options += WebKitLandingScripts.build_options()
-        options += WebKitLandingScripts.land_options()
+        options += BuildSteps.build_options()
+        options += BuildSteps.land_options()
         Command.__init__(self, "Land the current working directory diff and updates the associated bug if any", "[BUGID]", options=options)
 
     def guess_reviewer_from_bug(self, bugs, bug_id):
@@ -261,8 +263,8 @@ class CheckStyle(AbstractPatchProcessingCommand):
     name = "check-style"
     show_in_main_help = False
     def __init__(self):
-        options = WebKitLandingScripts.cleaning_options()
-        options += WebKitLandingScripts.build_options()
+        options = BuildSteps.cleaning_options()
+        options += BuildSteps.build_options()
         AbstractPatchProcessingCommand.__init__(self, "Run check-webkit-style on the specified attachments", "ATTACHMENT_ID [ATTACHMENT_IDS]", options)
 
     def _fetch_list_of_patches_to_process(self, options, args, tool):
@@ -291,8 +293,8 @@ class BuildAttachment(AbstractPatchProcessingCommand):
     name = "build-attachment"
     show_in_main_help = False
     def __init__(self):
-        options = WebKitLandingScripts.cleaning_options()
-        options += WebKitLandingScripts.build_options()
+        options = BuildSteps.cleaning_options()
+        options += BuildSteps.build_options()
         AbstractPatchProcessingCommand.__init__(self, "Apply and build patches from bugzilla", "ATTACHMENT_ID [ATTACHMENT_IDS]", options)
 
     def _fetch_list_of_patches_to_process(self, options, args, tool):
@@ -309,9 +311,9 @@ class BuildAttachment(AbstractPatchProcessingCommand):
 
 class AbstractPatchLandingCommand(AbstractPatchProcessingCommand):
     def __init__(self, help_text, args_description):
-        options = WebKitLandingScripts.cleaning_options()
-        options += WebKitLandingScripts.build_options()
-        options += WebKitLandingScripts.land_options()
+        options = BuildSteps.cleaning_options()
+        options += BuildSteps.build_options()
+        options += BuildSteps.land_options()
         AbstractPatchProcessingCommand.__init__(self, help_text, args_description, options)
 
     def _prepare_to_process(self, options, args, tool):
@@ -352,9 +354,9 @@ class Rollout(Command):
     name = "rollout"
     show_in_main_help = True
     def __init__(self):
-        options = WebKitLandingScripts.cleaning_options()
-        options += WebKitLandingScripts.build_options()
-        options += WebKitLandingScripts.land_options()
+        options = BuildSteps.cleaning_options()
+        options += BuildSteps.build_options()
+        options += BuildSteps.land_options()
         options.append(make_option("--complete-rollout", action="store_true", dest="complete_rollout", help="Commit the revert and re-open the original bug."))
         Command.__init__(self, "Revert the given revision in the working copy and optionally commit the revert and re-open the original bug", "REVISION [BUGID]", options=options)
 
@@ -402,5 +404,7 @@ class Rollout(Command):
         if not options.complete_rollout:
             log("\nNOTE: Rollout support is experimental.\nPlease verify the rollout diff and use \"bugzilla-tool land-diff %s\" to commit the rollout." % bug_id)
         else:
-            comment_text = WebKitLandingScripts.build_and_commit(tool.scm(), options)
+            # FIXME: This function does not exist!!
+            # comment_text = WebKitLandingScripts.build_and_commit(tool.scm(), options)
+            raise ScriptError("OOPS! This option is not implemented (yet).")
             self._reopen_bug_after_rollout(tool, bug_id, comment_text)
index 2e66afb6940c6f5c4933b4352e00cebed9ff8c78..2c817253b3ef667be4d5a3f4862a0329da871d9f 100644 (file)
@@ -50,7 +50,6 @@ from modules.multicommandtool import MultiCommandTool, Command
 from modules.patchcollection import PatchCollection
 from modules.scm import CommitMessage, detect_scm_system, ScriptError, CheckoutNeedsUpdate
 from modules.statusbot import StatusBot
-from modules.webkitlandingscripts import WebKitLandingScripts, commit_message_for_this_commit
 from modules.webkitport import WebKitPort
 from modules.workqueue import WorkQueue, WorkQueueDelegate
 
index e88562336f9895bc8a3486afe9fb3e3c139bae84..512615312125a370e191a0fbc3137a8fe639470c 100644 (file)
@@ -50,11 +50,10 @@ from modules.multicommandtool import MultiCommandTool, Command
 from modules.patchcollection import PatchCollection
 from modules.scm import CommitMessage, detect_scm_system, ScriptError, CheckoutNeedsUpdate
 from modules.statusbot import StatusBot
-from modules.webkitlandingscripts import WebKitLandingScripts, commit_message_for_this_commit
 from modules.webkitport import WebKitPort
 from modules.workqueue import WorkQueue, WorkQueueDelegate
 
-# FIXME: Requires unit test.  Blocking issue: commit_message_for_this_commit.
+# FIXME: Requires unit test.
 class CommitMessageForCurrentDiff(Command):
     name = "commit-message"
     show_in_main_help = False
@@ -63,7 +62,7 @@ class CommitMessageForCurrentDiff(Command):
 
     def execute(self, options, args, tool):
         os.chdir(tool.scm().checkout_root)
-        print "%s" % commit_message_for_this_commit(tool.scm()).message()
+        print "%s" % tool.scm().commit_message_for_this_commit().message()
 
 
 class ObsoleteAttachments(Command):
@@ -229,7 +228,7 @@ class CreateBug(Command):
         if options.prompt:
             (bug_title, comment_text) = self.prompt_for_bug_title_and_comment()
         else:
-            commit_message = commit_message_for_this_commit(tool.scm())
+            commit_message = tool.scm().commit_message_for_this_commit()
             bug_title = commit_message.description(lstrip=True, strip_url=True)
             comment_text = commit_message.body(lstrip=True)
 
index fbf5e951ead32125d7a0add9a67710ddc92f5655..0d283e6026e4268055df1cf2be986ebddc04d2e0 100644 (file)
@@ -31,7 +31,6 @@
 from modules.comments import bug_comment_from_commit_text
 from modules.logging import log
 from modules.scm import ScriptError, CheckoutNeedsUpdate
-from modules.webkitlandingscripts import WebKitLandingScripts, commit_message_for_this_commit
 from modules.webkitport import WebKitPort
 from modules.workqueue import WorkQueue
 
@@ -88,7 +87,7 @@ class LandingSequence:
         self._tool.run_tests(launch_safari=not self._options.non_interactive, fail_fast=self._options.non_interactive, quiet=self._options.quiet, port=self._port)
 
     def commit(self):
-        commit_message = commit_message_for_this_commit(self._tool.scm())
+        commit_message = self._tool.scm().commit_message_for_this_commit()
         return self._tool.scm().commit_with_message(commit_message.message())
 
     def close_patch(self, commit_log):
index ad95d26978f58d90cd85064940b70a3dbe429e3c..d322762c7a76941525c66ac7aa0601da35910882 100644 (file)
@@ -34,6 +34,7 @@ import re
 import subprocess
 
 # Import WebKit-specific modules.
+from modules.changelogs import ChangeLog
 from modules.logging import error, log
 
 def detect_scm_system(path):
@@ -210,6 +211,28 @@ class SCM:
                 changelog_paths.append(path)
         return changelog_paths
 
+    # FIXME: Requires unit test
+    # FIXME: commit_message_for_this_commit and modified_changelogs don't
+    #        really belong here.  We should have a separate module for
+    #        handling ChangeLogs.
+    def commit_message_for_this_commit(self):
+        changelog_paths = self.modified_changelogs()
+        if not len(changelog_paths):
+            raise ScriptError(message="Found no modified ChangeLogs, cannot create a commit message.\n"
+                              "All changes require a ChangeLog.  See:\n"
+                              "http://webkit.org/coding/contributing.html")
+
+        changelog_messages = []
+        for changelog_path in changelog_paths:
+            log("Parsing ChangeLog: %s" % changelog_path)
+            changelog_entry = ChangeLog(changelog_path).latest_entry()
+            if not changelog_entry:
+                raise ScriptError(message="Failed to parse ChangeLog: " + os.path.abspath(changelog_path))
+            changelog_messages.append(changelog_entry)
+
+        # FIXME: We should sort and label the ChangeLog messages like commit-log-editor does.
+        return CommitMessage("".join(changelog_messages).splitlines())
+
     @staticmethod
     def in_working_directory(path):
         raise NotImplementedError, "subclasses must implement"
diff --git a/WebKitTools/Scripts/modules/webkitlandingscripts.py b/WebKitTools/Scripts/modules/webkitlandingscripts.py
deleted file mode 100644 (file)
index 96aa47b..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2009, Google Inc. All rights reserved.
-# Copyright (c) 2009 Apple 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
-import StringIO
-import subprocess
-import sys
-
-from optparse import make_option
-
-from modules.changelogs import ChangeLog
-from modules.logging import error, log, tee
-from modules.scm import CommitMessage, detect_scm_system, ScriptError, CheckoutNeedsUpdate
-from modules.webkitport import WebKitPort
-
-def commit_message_for_this_commit(scm):
-    changelog_paths = scm.modified_changelogs()
-    if not len(changelog_paths):
-        raise ScriptError(message="Found no modified ChangeLogs, cannot create a commit message.\n"
-                          "All changes require a ChangeLog.  See:\n"
-                          "http://webkit.org/coding/contributing.html")
-
-    changelog_messages = []
-    for changelog_path in changelog_paths:
-        log("Parsing ChangeLog: %s" % changelog_path)
-        changelog_entry = ChangeLog(changelog_path).latest_entry()
-        if not changelog_entry:
-            raise ScriptError(message="Failed to parse ChangeLog: " + os.path.abspath(changelog_path))
-        changelog_messages.append(changelog_entry)
-
-    # FIXME: We should sort and label the ChangeLog messages like commit-log-editor does.
-    return CommitMessage("".join(changelog_messages).splitlines())
-
-
-class WebKitLandingScripts:
-    @staticmethod
-    def cleaning_options():
-        return [
-            make_option("--force-clean", action="store_true", dest="force_clean", default=False, help="Clean working directory before applying patches (removes local changes and commits)"),
-            make_option("--no-clean", action="store_false", dest="clean", default=True, help="Don't check if the working directory is clean before applying patches"),
-        ]
-
-    @staticmethod
-    def build_options():
-        return [
-            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."),
-        ] + WebKitPort.port_options()
-
-    @staticmethod
-    def land_options():
-        return [
-            make_option("--no-update", action="store_false", dest="update", default=True, help="Don't update the working directory."),
-            make_option("--no-build", action="store_false", dest="build", default=True, help="Commit without building first, implies --no-test."),
-            make_option("--no-test", action="store_false", dest="test", default=True, help="Commit without running run-webkit-tests."),
-            make_option("--no-close", action="store_false", dest="close_bug", default=True, help="Leave bug open after landing."),
-        ]
-
-
-
-