[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
abarth at webkit.org
abarth at webkit.org
Tue Jan 5 23:49:39 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 69e0c27a229e7d8a6b0ee6bf4cf3fda967c2bba5
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Dec 15 05:32:03 2009 +0000
2009-12-14 Adam Barth <abarth at webkit.org>
Reviewed by Eric Seidel.
[bzt] Kill WebKitApplyingScripts
https://bugs.webkit.org/show_bug.cgi?id=32467
Ah! I've been wanting to do this for a long time. This patch brings
the applying commands into the patch processing fold.
* Scripts/bugzilla-tool:
* Scripts/modules/buildsteps.py:
* Scripts/modules/commands/download.py:
* Scripts/modules/commands/download_unittest.py:
* Scripts/modules/mock_bugzillatool.py:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52131 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index bef1979..e004c29 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -2,6 +2,22 @@
Reviewed by Eric Seidel.
+ [bzt] Kill WebKitApplyingScripts
+ https://bugs.webkit.org/show_bug.cgi?id=32467
+
+ Ah! I've been wanting to do this for a long time. This patch brings
+ the applying commands into the patch processing fold.
+
+ * Scripts/bugzilla-tool:
+ * Scripts/modules/buildsteps.py:
+ * Scripts/modules/commands/download.py:
+ * Scripts/modules/commands/download_unittest.py:
+ * Scripts/modules/mock_bugzillatool.py:
+
+2009-12-14 Adam Barth <abarth at webkit.org>
+
+ Reviewed by Eric Seidel.
+
[bzt] Convert rollout to StepSequence
https://bugs.webkit.org/show_bug.cgi?id=32406
diff --git a/WebKitTools/Scripts/bugzilla-tool b/WebKitTools/Scripts/bugzilla-tool
index fdbb740..23245f6 100755
--- a/WebKitTools/Scripts/bugzilla-tool
+++ b/WebKitTools/Scripts/bugzilla-tool
@@ -34,7 +34,6 @@ import os
from modules.bugzilla import Bugzilla
from modules.buildbot import BuildBot
-from modules.buildsteps import BuildSteps
from modules.commands.download import *
from modules.commands.early_warning_system import *
from modules.commands.queries import *
@@ -55,7 +54,6 @@ class BugzillaTool(MultiCommandTool):
self.executive = Executive()
self._scm = None
self._status = None
- self.steps = BuildSteps()
def dry_run_callback(self, option, opt, value, parser):
self.scm().dryrun = True
diff --git a/WebKitTools/Scripts/modules/buildsteps.py b/WebKitTools/Scripts/modules/buildsteps.py
index 4d5da58..9b53f12 100644
--- a/WebKitTools/Scripts/modules/buildsteps.py
+++ b/WebKitTools/Scripts/modules/buildsteps.py
@@ -44,6 +44,7 @@ class CommandOptions(object):
non_interactive = make_option("--non-interactive", action="store_true", dest="non_interactive", default=False, help="Never prompt the user, fail as fast as possible.")
parent_command = make_option("--parent-command", action="store", dest="parent_command", default=None, help="(Internal) The command that spawned this instance.")
update = make_option("--no-update", action="store_false", dest="update", default=True, help="Don't update the working directory.")
+ local_commit = make_option("--local-commit", action="store_true", dest="local_commit", default=False, help="Make a local commit for each applied patch")
build = make_option("--no-build", action="store_false", dest="build", default=True, help="Commit without building first, implies --no-test.")
test = make_option("--no-test", action="store_false", dest="test", default=True, help="Commit without running run-webkit-tests.")
close_bug = make_option("--no-close", action="store_false", dest="close_bug", default=True, help="Leave bug open after landing.")
@@ -141,6 +142,12 @@ class CleanWorkingDirectoryStep(AbstractStep):
self._tool.scm().ensure_clean_working_directory(force_clean=self._options.force_clean)
+class CleanWorkingDirectoryWithLocalCommitsStep(CleanWorkingDirectoryStep):
+ def __init__(self, tool, options):
+ # FIXME: This a bit of a hack. Consider doing this more cleanly.
+ CleanWorkingDirectoryStep.__init__(self, tool, options, allow_local_commits=True)
+
+
class UpdateStep(AbstractStep):
@classmethod
def options(cls):
@@ -173,6 +180,20 @@ class RevertRevisionStep(AbstractStep):
self._tool.scm().apply_reverse_diff(state["revision"])
+class ApplyPatchWithLocalCommitStep(ApplyPatchStep):
+ @classmethod
+ def options(cls):
+ return [
+ CommandOptions.local_commit,
+ ] + ApplyPatchStep.options()
+
+ def run(self, state):
+ ApplyPatchStep.run(self, state)
+ if self._options.local_commit:
+ commit_message = self._tool.scm().commit_message_for_this_commit()
+ self._tool.scm().commit_locally_with_message(commit_message.message() or state["patch"]["name"])
+
+
class EnsureBuildersAreGreenStep(AbstractStep):
@classmethod
def options(cls):
@@ -354,35 +375,3 @@ class CompleteRollout(MetaStep):
return
# FIXME: I'm not sure state["commit_text"] is quite right here.
self._tool.bugs.reopen_bug(bug_id, state["commit_text"])
-
-
-# FIXME: This class is a dinosaur and should be extinct soon.
-class BuildSteps:
- # FIXME: The options should really live on each "Step" object.
- @staticmethod
- def cleaning_options():
- return [
- CommandOptions.force_clean,
- CommandOptions.clean,
- ]
-
- # FIXME: These distinctions are bogus. We need a better model for handling options.
- @staticmethod
- def build_options():
- return [
- CommandOptions.check_builders,
- CommandOptions.quiet,
- CommandOptions.non_interactive,
- CommandOptions.parent_command,
- CommandOptions.port,
- ]
-
- @staticmethod
- def land_options():
- return [
- CommandOptions.update,
- CommandOptions.build,
- CommandOptions.test,
- CommandOptions.close_bug,
- ]
-
diff --git a/WebKitTools/Scripts/modules/commands/download.py b/WebKitTools/Scripts/modules/commands/download.py
index 0b6e3aa..779a159 100644
--- a/WebKitTools/Scripts/modules/commands/download.py
+++ b/WebKitTools/Scripts/modules/commands/download.py
@@ -34,7 +34,7 @@ from optparse import make_option
from modules.bugzilla import parse_bug_id
# FIXME: This list is rediculous. We need to learn the ways of __all__.
-from modules.buildsteps import CommandOptions, BuildSteps, EnsureBuildersAreGreenStep, UpdateChangelogsWithReviewerStep, CleanWorkingDirectoryStep, UpdateStep, ApplyPatchStep, BuildStep, CheckStyleStep, RunTestsStep, CommitStep, ClosePatchStep, CloseBugStep, CloseBugForLandDiffStep, PrepareChangelogStep, PrepareChangelogForRevertStep, RevertRevisionStep, CompleteRollout
+from modules.buildsteps import CommandOptions, EnsureBuildersAreGreenStep, UpdateChangelogsWithReviewerStep, CleanWorkingDirectoryStep, CleanWorkingDirectoryWithLocalCommitsStep, UpdateStep, ApplyPatchStep, ApplyPatchWithLocalCommitStep, BuildStep, CheckStyleStep, RunTestsStep, CommitStep, ClosePatchStep, CloseBugStep, CloseBugForLandDiffStep, PrepareChangelogStep, PrepareChangelogForRevertStep, RevertRevisionStep, CompleteRollout
from modules.changelogs import ChangeLog
from modules.comments import bug_comment_from_commit_text
from modules.executive import ScriptError
@@ -59,65 +59,6 @@ class Build(Command):
self._sequence.run_and_handle_errors(tool, options)
-class ApplyAttachment(Command):
- name = "apply-attachment"
- show_in_main_help = True
- def __init__(self):
- 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):
- WebKitApplyingScripts.setup_for_patch_apply(tool, options)
- attachment_id = args[0]
- attachment = tool.bugs.fetch_attachment(attachment_id)
- WebKitApplyingScripts.apply_patches_with_options(tool.scm(), [attachment], options)
-
-
-class ApplyPatches(Command):
- name = "apply-patches"
- show_in_main_help = True
- def __init__(self):
- 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):
- WebKitApplyingScripts.setup_for_patch_apply(tool, options)
- bug_id = args[0]
- patches = tool.bugs.fetch_reviewed_patches_from_bug(bug_id)
- WebKitApplyingScripts.apply_patches_with_options(tool.scm(), patches, options)
-
-
-class WebKitApplyingScripts:
- @staticmethod
- def apply_options():
- return [
- make_option("--no-update", action="store_false", dest="update", default=True, help="Don't update the working directory before applying patches"),
- make_option("--local-commit", action="store_true", dest="local_commit", default=False, help="Make a local commit for each applied patch"),
- CommandOptions.port,
- ]
-
- @staticmethod
- def setup_for_patch_apply(tool, options):
- clean_step = CleanWorkingDirectoryStep(tool, options, allow_local_commits=True)
- clean_step.run({})
- update_step = UpdateStep(tool, options)
- update_step.run({})
-
- @staticmethod
- def apply_patches_with_options(scm, patches, options):
- if options.local_commit and not scm.supports_local_commits():
- error("--local-commit passed, but %s does not support local commits" % scm.display_name())
-
- for patch in patches:
- log("Applying attachment %s from bug %s" % (patch["id"], patch["bug_id"]))
- scm.apply_patch(patch)
- if options.local_commit:
- commit_message = scm.commit_message_for_this_commit()
- scm.commit_locally_with_message(commit_message.message() or patch["name"])
-
-
class LandDiff(Command):
name = "land-diff"
show_in_main_help = True
@@ -221,6 +162,54 @@ class BuildAttachment(AbstractPatchProcessingCommand):
self._sequence.run_and_handle_errors(tool, options, state)
+class AbstractPatchApplyingCommand(AbstractPatchProcessingCommand):
+ def __init__(self, help_text, args_description):
+ self._prepare_sequence = StepSequence([
+ CleanWorkingDirectoryWithLocalCommitsStep,
+ UpdateStep,
+ ])
+ self._main_sequence = StepSequence([
+ ApplyPatchWithLocalCommitStep,
+ ])
+ options = sorted(set(self._prepare_sequence.options() + self._main_sequence.options()))
+ AbstractPatchProcessingCommand.__init__(self, help_text, args_description, options)
+
+ def _prepare_to_process(self, options, args, tool):
+ if options.local_commit and not tool.scm().supports_local_commits():
+ error("--local-commit passed, but %s does not support local commits" % scm.display_name())
+ self._prepare_sequence.run_and_handle_errors(tool, options)
+
+ # FIXME: Add a base class to share this code.
+ def _process_patch(self, patch, options, args, tool):
+ state = {"patch": patch}
+ self._main_sequence.run_and_handle_errors(tool, options, state)
+
+
+class ApplyAttachment(AbstractPatchApplyingCommand):
+ name = "apply-attachment"
+ show_in_main_help = True
+ def __init__(self):
+ AbstractPatchApplyingCommand.__init__(self, "Apply an attachment to the local working directory", "ATTACHMENT_ID [ATTACHMENT_IDS]")
+
+ def _fetch_list_of_patches_to_process(self, options, args, tool):
+ return map(lambda patch_id: tool.bugs.fetch_attachment(patch_id), args)
+
+
+class ApplyPatches(AbstractPatchApplyingCommand):
+ name = "apply-patches"
+ show_in_main_help = True
+ def __init__(self):
+ AbstractPatchApplyingCommand.__init__(self, "Apply reviewed patches from provided bugs to the local working directory", "BUGID [BUGIDS]")
+
+ def _fetch_list_of_patches_to_process(self, options, args, tool):
+ all_patches = []
+ for bug_id in args:
+ patches = tool.bugs.fetch_reviewed_patches_from_bug(bug_id)
+ log("%s found on bug %s." % (pluralize("reviewed patch", len(patches)), bug_id))
+ all_patches += patches
+ return all_patches
+
+
class AbstractPatchLandingCommand(AbstractPatchProcessingCommand):
def __init__(self, help_text, args_description):
self._sequence = StepSequence([
diff --git a/WebKitTools/Scripts/modules/commands/download_unittest.py b/WebKitTools/Scripts/modules/commands/download_unittest.py
index e7bda41..b247efc 100644
--- a/WebKitTools/Scripts/modules/commands/download_unittest.py
+++ b/WebKitTools/Scripts/modules/commands/download_unittest.py
@@ -55,14 +55,14 @@ class DownloadCommandsTest(CommandsTest):
options = self._default_options()
options.update = True
options.local_commit = True
- expected_stderr = "Updating working directory\nApplying attachment 197 from bug 42\n"
+ expected_stderr = "Updating working directory\nProcessing 1 patch from 1 bug.\nProcessing patch 197 from bug 42.\n"
self.assert_execute_outputs(ApplyAttachment(), [197], options=options, expected_stderr=expected_stderr)
def test_apply_patches(self):
options = self._default_options()
options.update = True
options.local_commit = True
- expected_stderr = "Updating working directory\nApplying attachment 197 from bug 42\nApplying attachment 128 from bug 42\n"
+ expected_stderr = "Updating working directory\n2 reviewed patches found on bug 42.\nProcessing 2 patches from 1 bug.\nProcessing patch 197 from bug 42.\nProcessing patch 128 from bug 42.\n"
self.assert_execute_outputs(ApplyPatches(), [42], options=options, expected_stderr=expected_stderr)
def test_land_diff(self):
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list