[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:59:30 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 90620fd83ef41b65adf9e3b98e2aa4177c8ef6ad
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 23 20:40:03 2009 +0000

    2009-12-23  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Eric Seidel.
    
            [bzt] Create a prepare-diff command that creates a bug and a ChangeLog
            https://bugs.webkit.org/show_bug.cgi?id=32895
    
            The workflow Maciej and I discussed is as follows:
    
            1) Write code.
            2) bugzilla-tool prepare-diff
            3) Edit ChangeLogs
            4) bugzilla-tool post-diff
    
            We might want to experimenting with combining 2-4 into a single
            command, but that might be stressful to edit the ChangeLogs modally.
    
            Removed submit-patch since it has the modal ChangeLog editing but none
            oof the bug creating fun.
    
            * Scripts/modules/bugzilla.py:
            * Scripts/modules/buildsteps.py:
            * Scripts/modules/commands/upload.py:
            * Scripts/modules/commands/upload_unittest.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52528 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 6809b9e..f7a4e36 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,28 @@
+2009-12-23  Adam Barth  <abarth at webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        [bzt] Create a prepare-diff command that creates a bug and a ChangeLog
+        https://bugs.webkit.org/show_bug.cgi?id=32895
+
+        The workflow Maciej and I discussed is as follows:
+
+        1) Write code.
+        2) bugzilla-tool prepare-diff
+        3) Edit ChangeLogs
+        4) bugzilla-tool post-diff
+
+        We might want to experimenting with combining 2-4 into a single
+        command, but that might be stressful to edit the ChangeLogs modally.
+
+        Removed submit-patch since it has the modal ChangeLog editing but none
+        oof the bug creating fun.
+
+        * Scripts/modules/bugzilla.py:
+        * Scripts/modules/buildsteps.py:
+        * Scripts/modules/commands/upload.py:
+        * Scripts/modules/commands/upload_unittest.py:
+
 2009-12-23  Gabor Loki  <loki at webkit.org>
 
         Unreviewed; added myself to the committers list.
diff --git a/WebKitTools/Scripts/modules/bugzilla.py b/WebKitTools/Scripts/modules/bugzilla.py
index 372cabd..9a467ed 100644
--- a/WebKitTools/Scripts/modules/bugzilla.py
+++ b/WebKitTools/Scripts/modules/bugzilla.py
@@ -365,10 +365,10 @@ class Bugzilla(object):
             error_message = "\n" + '\n'.join(["  " + line.strip() for line in text_lines if line.strip()])
         raise BugzillaError("Bug not created: %s" % error_message)
 
-    def create_bug_with_patch(self, bug_title, bug_description, component, patch_file_object, patch_description, cc, mark_for_review=False, mark_for_commit_queue=False):
+    def create_bug(self, bug_title, bug_description, component=None, patch_file_object=None, patch_description=None, cc=None, mark_for_review=False, mark_for_commit_queue=False):
         self.authenticate()
 
-        log('Creating bug with patch description "%s"' % patch_description)
+        log('Creating bug with title "%s"' % bug_title)
         if self.dryrun:
             log(bug_description)
             return
@@ -383,11 +383,11 @@ class Bugzilla(object):
         if cc:
             self.browser['cc'] = cc
         self.browser['short_desc'] = bug_title
-        if bug_description:
-            log(bug_description)
-            self.browser['comment'] = bug_description
+        self.browser['comment'] = bug_description
+
+        if patch_file_object:
+            self._fill_attachment_form(patch_description, patch_file_object, mark_for_review=mark_for_review, mark_for_commit_queue=mark_for_commit_queue)
 
-        self._fill_attachment_form(patch_description, patch_file_object, mark_for_review=mark_for_review, mark_for_commit_queue=mark_for_commit_queue)
         response = self.browser.submit()
 
         bug_id = self._check_create_bug_response(response.read())
diff --git a/WebKitTools/Scripts/modules/buildsteps.py b/WebKitTools/Scripts/modules/buildsteps.py
index 6e1f9df..e8d151b 100644
--- a/WebKitTools/Scripts/modules/buildsteps.py
+++ b/WebKitTools/Scripts/modules/buildsteps.py
@@ -57,6 +57,8 @@ class CommandOptions(object):
     review = make_option("--no-review", action="store_false", dest="review", default=True, help="Do not mark the patch for review.")
     request_commit = make_option("--request-commit", action="store_true", dest="request_commit", default=False, help="Mark the patch as needing auto-commit after review.")
     description = make_option("-m", "--description", action="store", type="string", dest="description", help="Description string for the attachment (default: \"patch\")")
+    cc = make_option("--cc", action="store", type="string", dest="cc", help="Comma-separated list of email addresses to carbon-copy.")
+    component = make_option("--component", action="store", type="string", dest="component", help="Component for the new bug.")
 
 
 class AbstractStep(object):
@@ -110,25 +112,52 @@ class MetaStep(AbstractStep):
              step.run(state)
 
 
-class PrepareChangelogStep(AbstractStep):
+class PromptForBugOrTitleStep(AbstractStep):
+    def run(self, state):
+        # No need to prompt if we alrady have the bug_id.
+        if state.get("bug_id"):
+            return
+        user_response = self._tool.user.prompt("Please enter a bug number or a title for a new bug:\n")
+        # If the user responds with a number, we assume it's bug number.
+        # Otherwise we assume it's a bug subject.
+        try:
+            state["bug_id"] = int(user_response)
+            return int_value
+        except ValueError, TypeError:
+            state["bug_title"] = user_response
+            # FIXME: This is kind of a lame description.
+            state["bug_description"] = user_response
+
+
+class CreateBugStep(AbstractStep):
+    @classmethod
+    def options(cls):
+        return [
+            CommandOptions.cc,
+            CommandOptions.component,
+        ]
+
+    def run(self, state):
+        # No need to create a bug if we already have one.
+        if state.get("bug_id"):
+            return
+        state["bug_id"] = self._tool.bugs.create_bug(state["bug_title"], state["bug_description"], component=self._options.component, cc=self._options.cc)
+
+
+class PrepareChangeLogStep(AbstractStep):
     @classmethod
     def options(cls):
         return [
             CommandOptions.port,
             CommandOptions.quiet,
-            CommandOptions.non_interactive,
         ]
 
     def run(self, state):
         os.chdir(self._tool.scm().checkout_root)
         args = [self.port().script_path("prepare-ChangeLog")]
-        if not self._options.non_interactive:
-            args.append("-o")
         if state["bug_id"]:
             args.append("--bug=%s" % state["bug_id"])
         self._tool.executive.run_and_throw_if_fail(args, self._options.quiet)
-        if not self._options.non_interactive:
-            self._tool.user.prompt("Press enter when ready to continue.")
 
 
 class ObsoletePatchesOnBugStep(AbstractStep):
@@ -166,7 +195,7 @@ class PostDiffToBugStep(AbstractStep):
         self._tool.bugs.add_patch_to_bug(state["bug_id"], diff_file, description, mark_for_review=self._options.review, mark_for_commit_queue=self._options.request_commit)
 
 
-class PrepareChangelogForRevertStep(AbstractStep):
+class PrepareChangeLogForRevertStep(AbstractStep):
     def run(self, state):
         # First, discard the ChangeLog changes from the rollout.
         os.chdir(self._tool.scm().checkout_root)
@@ -281,7 +310,7 @@ class EnsureLocalCommitIfNeeded(AbstractStep):
             error("--local-commit passed, but %s does not support local commits" % self._tool.scm.display_name())
 
 
-class UpdateChangelogsWithReviewerStep(AbstractStep):
+class UpdateChangeLogsWithReviewerStep(AbstractStep):
     @classmethod
     def options(cls):
         return [
diff --git a/WebKitTools/Scripts/modules/buildsteps_unittest.py b/WebKitTools/Scripts/modules/buildsteps_unittest.py
index b7fbb0c..5c6c1fc 100644
--- a/WebKitTools/Scripts/modules/buildsteps_unittest.py
+++ b/WebKitTools/Scripts/modules/buildsteps_unittest.py
@@ -28,16 +28,16 @@
 
 import unittest
 
-from modules.buildsteps import UpdateChangelogsWithReviewerStep, UpdateStep
+from modules.buildsteps import UpdateChangeLogsWithReviewerStep, UpdateStep
 from modules.mock_bugzillatool import MockBugzillaTool
 from modules.outputcapture import OutputCapture
 from modules.mock import Mock
 
 
-class UpdateChangelogsWithReviewerStepTest(unittest.TestCase):
+class UpdateChangeLogsWithReviewerStepTest(unittest.TestCase):
     def test_guess_reviewer_from_bug(self):
         capture = OutputCapture()
-        step = UpdateChangelogsWithReviewerStep(MockBugzillaTool(), [])
+        step = UpdateChangeLogsWithReviewerStep(MockBugzillaTool(), [])
         expected_stderr = "0 reviewed patches on bug 1, cannot infer reviewer.\n"
         capture.assert_outputs(self, step._guess_reviewer_from_bug, [1], expected_stderr=expected_stderr)
 
diff --git a/WebKitTools/Scripts/modules/commands/download.py b/WebKitTools/Scripts/modules/commands/download.py
index 555c58d..41b5eb1 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, EnsureBuildersAreGreenStep, EnsureLocalCommitIfNeeded, UpdateChangelogsWithReviewerStep, CleanWorkingDirectoryStep, CleanWorkingDirectoryWithLocalCommitsStep, UpdateStep, ApplyPatchStep, ApplyPatchWithLocalCommitStep, BuildStep, CheckStyleStep, RunTestsStep, CommitStep, ClosePatchStep, CloseBugStep, CloseBugForLandDiffStep, PrepareChangelogStep, PrepareChangelogForRevertStep, RevertRevisionStep, CompleteRollout
+from modules.buildsteps import CommandOptions, EnsureBuildersAreGreenStep, EnsureLocalCommitIfNeeded, UpdateChangeLogsWithReviewerStep, CleanWorkingDirectoryStep, CleanWorkingDirectoryWithLocalCommitsStep, UpdateStep, ApplyPatchStep, ApplyPatchWithLocalCommitStep, BuildStep, CheckStyleStep, RunTestsStep, CommitStep, ClosePatchStep, CloseBugStep, CloseBugForLandDiffStep, PrepareChangeLogForRevertStep, RevertRevisionStep, CompleteRollout
 from modules.changelogs import ChangeLog
 from modules.comments import bug_comment_from_commit_text
 from modules.executive import ScriptError
@@ -83,7 +83,7 @@ class LandDiff(AbstractSequencedCommmand):
     show_in_main_help = True
     steps = [
         EnsureBuildersAreGreenStep,
-        UpdateChangelogsWithReviewerStep,
+        UpdateChangeLogsWithReviewerStep,
         EnsureBuildersAreGreenStep,
         BuildStep,
         RunTestsStep,
@@ -250,7 +250,7 @@ class Rollout(Command):
             CleanWorkingDirectoryStep,
             UpdateStep,
             RevertRevisionStep,
-            PrepareChangelogForRevertStep,
+            PrepareChangeLogForRevertStep,
             CompleteRollout,
         ])
         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=self._sequence.options())
diff --git a/WebKitTools/Scripts/modules/commands/upload.py b/WebKitTools/Scripts/modules/commands/upload.py
index d8de19a..c0e4927 100644
--- a/WebKitTools/Scripts/modules/commands/upload.py
+++ b/WebKitTools/Scripts/modules/commands/upload.py
@@ -36,7 +36,7 @@ import sys
 from optparse import make_option
 
 from modules.bugzilla import parse_bug_id
-from modules.buildsteps import PrepareChangelogStep, CommandOptions, ObsoletePatchesOnBugStep, PostDiffToBugStep
+from modules.buildsteps import PrepareChangeLogStep, CommandOptions, ObsoletePatchesOnBugStep, PostDiffToBugStep, PromptForBugOrTitleStep, CreateBugStep
 from modules.commands.download import AbstractSequencedCommmand
 from modules.comments import bug_comment_from_svn_revision
 from modules.grammar import pluralize
@@ -89,19 +89,18 @@ class PostDiff(AbstractSequencedCommmand):
         return state
 
 
-class SubmitPatch(AbstractSequencedCommmand):
-    name = "submit-patch"
-    help_text = "Experimental.  Creates a patch from the current working copy and uploads bugzilla"
-    argument_names = "BUGID"
+class PrepareDiff(AbstractSequencedCommmand):
+    name = "prepare-diff"
+    help_text = "Creates a bug (or prompts for an existing bug) and prepares the ChangeLogs"
+    argument_names = "[BUGID]"
     steps = [
-        PrepareChangelogStep,
-        # FIXME: Add a CreateBugStep!
-        ObsoletePatchesOnBugStep,
-        PostDiffToBugStep,
+        PromptForBugOrTitleStep,
+        CreateBugStep,
+        PrepareChangeLogStep,
     ]
 
     def _prepare_state(self, options, args, tool):
-        bug_id = args[0]
+        bug_id = args and args[0]
         return { "bug_id" : bug_id }
 
 
@@ -250,8 +249,8 @@ class CreateBug(Command):
     show_in_main_help = True
     def __init__(self):
         options = [
-            make_option("--cc", action="store", type="string", dest="cc", help="Comma-separated list of email addresses to carbon-copy."),
-            make_option("--component", action="store", type="string", dest="component", help="Component for the new bug."),
+            CommandOptions.cc,
+            CommandOptions.component,
             make_option("--no-prompt", action="store_false", dest="prompt", default=True, help="Do not prompt for bug title and comment; use commit log instead."),
             make_option("--no-review", action="store_false", dest="review", default=True, help="Do not mark the patch for review."),
             make_option("--request-commit", action="store_true", dest="request_commit", default=False, help="Mark the patch as needing auto-commit after review."),
@@ -277,8 +276,8 @@ class CreateBug(Command):
             comment_text += tool.scm().files_changed_summary_for_commit(commit_id)
 
         diff = tool.scm().create_patch_from_local_commit(commit_id)
-        diff_file = StringIO.StringIO(diff) # create_bug_with_patch expects a file-like object
-        bug_id = tool.bugs.create_bug_with_patch(bug_title, comment_text, options.component, diff_file, "Patch", cc=options.cc, mark_for_review=options.review, mark_for_commit_queue=options.request_commit)
+        diff_file = StringIO.StringIO(diff) # create_bug expects a file-like object
+        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)
 
         if bug_id and len(commit_ids) > 1:
             options.bug_id = bug_id
@@ -297,8 +296,8 @@ class CreateBug(Command):
             comment_text = commit_message.body(lstrip=True)
 
         diff = tool.scm().create_patch()
-        diff_file = StringIO.StringIO(diff) # create_bug_with_patch expects a file-like object
-        bug_id = tool.bugs.create_bug_with_patch(bug_title, comment_text, options.component, diff_file, "Patch", cc=options.cc, mark_for_review=options.review, mark_for_commit_queue=options.request_commit)
+        diff_file = StringIO.StringIO(diff) # create_bug expects a file-like object
+        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: ")
diff --git a/WebKitTools/Scripts/modules/commands/upload_unittest.py b/WebKitTools/Scripts/modules/commands/upload_unittest.py
index ff7371f..1dd01d1 100644
--- a/WebKitTools/Scripts/modules/commands/upload_unittest.py
+++ b/WebKitTools/Scripts/modules/commands/upload_unittest.py
@@ -40,6 +40,8 @@ class UploadCommandsTest(CommandsTest):
         expected_stderr = "Obsoleting 2 old patches on bug 42\n"
         self.assert_execute_outputs(PostDiff(), [42], expected_stderr=expected_stderr)
 
-    def test_submit_patch(self):
-        expected_stderr = "Obsoleting 2 old patches on bug 42\n"
-        self.assert_execute_outputs(SubmitPatch(), [42], expected_stderr=expected_stderr)
+    def test_prepare_diff_with_arg(self):
+        self.assert_execute_outputs(PrepareDiff(), [42])
+
+    def test_prepare_diff(self):
+        self.assert_execute_outputs(PrepareDiff(), [])

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list