[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

abarth at webkit.org abarth at webkit.org
Thu Apr 8 00:53:00 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 55c677aee3b480a6bb41fe3447aaaac62a21ef7f
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jan 4 07:08:08 2010 +0000

    2010-01-03  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Eric Seidel.
    
            [bzt] Make it easier to run submit-patch when previous run cancelled
            https://bugs.webkit.org/show_bug.cgi?id=33070
    
            This patch renames create-review to submit-patch (as requested by
            Maciej).
    
            This patch makes it easier to run submit-patch after the user has
            already cancelled a previous run of submit-patch by detecting when we
            already have ChangeLogs and reading the bug number from them (and not
            attempting to recreate them).  Aside from performance and the extra
            edit step, this command should not subsume post-dif.
    
            Also, added a --email command line argument so that the output of
            prepare-ChangeLog makes sense when it can't find the user's email
            address.
    
            * Scripts/webkitpy/bugzilla.py:
            * Scripts/webkitpy/buildsteps.py:
            * Scripts/webkitpy/commands/upload.py:
            * Scripts/webkitpy/commands/upload_unittest.py:
            * Scripts/webkitpy/mock_bugzillatool.py:
            * Scripts/webkitpy/user.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52704 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 74cf749..cf6192b 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,30 @@
+2010-01-03  Adam Barth  <abarth at webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        [bzt] Make it easier to run submit-patch when previous run cancelled
+        https://bugs.webkit.org/show_bug.cgi?id=33070
+
+        This patch renames create-review to submit-patch (as requested by
+        Maciej).
+
+        This patch makes it easier to run submit-patch after the user has
+        already cancelled a previous run of submit-patch by detecting when we
+        already have ChangeLogs and reading the bug number from them (and not
+        attempting to recreate them).  Aside from performance and the extra
+        edit step, this command should not subsume post-dif.
+
+        Also, added a --email command line argument so that the output of
+        prepare-ChangeLog makes sense when it can't find the user's email
+        address.
+
+        * Scripts/webkitpy/bugzilla.py:
+        * Scripts/webkitpy/buildsteps.py:
+        * Scripts/webkitpy/commands/upload.py:
+        * Scripts/webkitpy/commands/upload_unittest.py:
+        * Scripts/webkitpy/mock_bugzillatool.py:
+        * Scripts/webkitpy/user.py:
+
 2010-01-03  Eric Seidel  <eric at webkit.org>
 
         Reviewed by Adam Barth.
diff --git a/WebKitTools/Scripts/webkitpy/bugzilla.py b/WebKitTools/Scripts/webkitpy/bugzilla.py
index 4f73d59..abf5fc1 100644
--- a/WebKitTools/Scripts/webkitpy/bugzilla.py
+++ b/WebKitTools/Scripts/webkitpy/bugzilla.py
@@ -351,8 +351,9 @@ class Bugzilla(object):
 
     def add_patch_to_bug(self, bug_id, patch_file_object, description, comment_text=None, mark_for_review=False, mark_for_commit_queue=False):
         self.authenticate()
-        
-        log('Adding patch "%s" to bug %s' % (description, bug_id))
+
+        log('Adding patch "%s" to %sshow_bug.cgi?id=%s' % (description, self.bug_server_url, bug_id))
+
         if self.dryrun:
             log(comment_text)
             return
diff --git a/WebKitTools/Scripts/webkitpy/buildsteps.py b/WebKitTools/Scripts/webkitpy/buildsteps.py
index 230541e..4c2125c 100644
--- a/WebKitTools/Scripts/webkitpy/buildsteps.py
+++ b/WebKitTools/Scripts/webkitpy/buildsteps.py
@@ -87,6 +87,7 @@ class CommandOptions(object):
     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.")
     confirm = make_option("--no-confirm", action="store_false", dest="confirm", default=True, help="Skip confirmation steps.")
+    email = make_option("--email", action="store", type="string", dest="email", help="Email address to use in ChangeLogs.")
 
 
 class AbstractStep(object):
@@ -107,6 +108,19 @@ class AbstractStep(object):
         self._port = WebKitPort.port(self._options.port)
         return self._port
 
+    _well_known_keys = {
+        "diff" : lambda self: self._tool.scm().create_patch(),
+        "changelogs" : lambda self: self._tool.scm().modified_changelogs(),
+    }
+
+    def cached_lookup(self, state, key, promise=None):
+        if state.get(key):
+            return state[key]
+        if not promise:
+            promise = self._well_known_keys.get(key)
+        state[key] = promise(self)
+        return state[key]
+
     @classmethod
     def options(cls):
         return []
@@ -177,19 +191,28 @@ class PrepareChangeLogStep(AbstractStep):
         return [
             CommandOptions.port,
             CommandOptions.quiet,
+            CommandOptions.email,
         ]
 
     def run(self, state):
+        if self.cached_lookup(state, "changelogs"):
+            return
         os.chdir(self._tool.scm().checkout_root)
         args = [self.port().script_path("prepare-ChangeLog")]
         if state["bug_id"]:
             args.append("--bug=%s" % state["bug_id"])
-        self._tool.executive.run_and_throw_if_fail(args, self._options.quiet)
+        if self._options.email:
+            args.append("--email=%s" % self._options.email)
+        try:
+            self._tool.executive.run_and_throw_if_fail(args, self._options.quiet)
+        except ScriptError, e:
+            error("Unable to prepare ChangeLogs.")
+        state["diff"] = None # We've changed the diff
 
 
 class EditChangeLogStep(AbstractStep):
     def run(self, state):
-        self._tool.user.edit(self._tool.scm().modified_changelogs())
+        self._tool.user.edit(self.cached_lookup(state, "changelogs"))
 
 
 class ObsoletePatchesOnBugStep(AbstractStep):
@@ -211,16 +234,7 @@ class ObsoletePatchesOnBugStep(AbstractStep):
             self._tool.bugs.obsolete_attachment(patch["id"])
 
 
-class AbstractDiffStep(AbstractStep):
-    def diff(self, state):
-        diff = state.get("diff")
-        if not diff:
-            diff = self._tool.scm().create_patch()
-            state["diff"] = diff
-        return diff
-
-
-class ConfirmDiffStep(AbstractDiffStep):
+class ConfirmDiffStep(AbstractStep):
     @classmethod
     def options(cls):
         return [
@@ -230,13 +244,13 @@ class ConfirmDiffStep(AbstractDiffStep):
     def run(self, state):
         if not self._options.confirm:
             return
-        diff = self.diff(state)
+        diff = self.cached_lookup(state, "diff")
         self._tool.user.page(diff)
-        if not self._tool.user.confirm():
+        if not self._tool.user.confirm("Was that diff correct?"):
             error("User declined to continue.")
 
 
-class PostDiffToBugStep(AbstractDiffStep):
+class PostDiffToBugStep(AbstractStep):
     @classmethod
     def options(cls):
         return [
@@ -246,7 +260,7 @@ class PostDiffToBugStep(AbstractDiffStep):
         ]
 
     def run(self, state):
-        diff = self.diff(state)
+        diff = self.cached_lookup(state, "diff")
         diff_file = StringIO.StringIO(diff) # add_patch_to_bug expects a file-like object
         description = self._options.description or "Patch"
         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)
diff --git a/WebKitTools/Scripts/webkitpy/commands/upload.py b/WebKitTools/Scripts/webkitpy/commands/upload.py
index d552901..bef9bdb 100644
--- a/WebKitTools/Scripts/webkitpy/commands/upload.py
+++ b/WebKitTools/Scripts/webkitpy/commands/upload.py
@@ -99,7 +99,17 @@ class ObsoleteAttachments(AbstractSequencedCommmand):
         return { "bug_id" : args[0] }
 
 
-class PostDiff(AbstractSequencedCommmand):
+class AbstractPatchUploadingCommand(AbstractSequencedCommmand):
+    def _bug_id(self, args, tool, state):
+        # Perfer a bug id passed as an argument over a bug url in the diff (i.e. ChangeLogs).
+        bug_id = args and args[0]
+        if not bug_id:
+            state["diff"] = tool.scm().create_patch()
+            bug_id = parse_bug_id(state["diff"])
+        return bug_id
+
+
+class PostDiff(AbstractPatchUploadingCommand):
     name = "post-diff"
     help_text = "Attach the current working directory diff to a bug as a patch file"
     argument_names = "[BUGID]"
@@ -111,15 +121,10 @@ class PostDiff(AbstractSequencedCommmand):
     ]
 
     def _prepare_state(self, options, args, tool):
-        # Perfer a bug id passed as an argument over a bug url in the diff (i.e. ChangeLogs).
         state = {}
-        bug_id = args and args[0]
-        if not bug_id:
-            state["diff"] = tool.scm().create_patch()
-            bug_id = parse_bug_id(state["diff"])
-        if not bug_id:
+        state["bug_id"] = self._bug_id(args, tool, state)
+        if not state["bug_id"]:
             error("No bug id passed and no bug url found in diff, can't post.")
-        state["bug_id"] = bug_id
         return state
 
 
@@ -138,9 +143,9 @@ class PrepareDiff(AbstractSequencedCommmand):
         return { "bug_id" : bug_id }
 
 
-class CreateReview(AbstractSequencedCommmand):
-    name = "create-review"
-    help_text = "Adds a ChangeLog to the current diff and posts it to a (possibly new) bug"
+class SubmitPatch(AbstractPatchUploadingCommand):
+    name = "submit-patch"
+    help_text = "Automates the process of uploading a patch for review"
     argument_names = "[BUGID]"
     steps = [
         PromptForBugOrTitleStep,
@@ -153,8 +158,9 @@ class CreateReview(AbstractSequencedCommmand):
     ]
 
     def _prepare_state(self, options, args, tool):
-        bug_id = args and args[0]
-        return { "bug_id" : bug_id }
+        state = {}
+        state["bug_id"] = self._bug_id(args, tool, state)
+        return state
 
 
 class EditChangeLog(AbstractSequencedCommmand):
diff --git a/WebKitTools/Scripts/webkitpy/commands/upload_unittest.py b/WebKitTools/Scripts/webkitpy/commands/upload_unittest.py
index b7a1c99..4a7f1cd 100644
--- a/WebKitTools/Scripts/webkitpy/commands/upload_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/commands/upload_unittest.py
@@ -53,9 +53,9 @@ class UploadCommandsTest(CommandsTest):
     def test_prepare_diff(self):
         self.assert_execute_outputs(PrepareDiff(), [])
 
-    def test_create_review(self):
+    def test_submit_patch(self):
         expected_stderr = "Obsoleting 2 old patches on bug 42\n"
-        self.assert_execute_outputs(CreateReview(), [42], expected_stderr=expected_stderr)
+        self.assert_execute_outputs(SubmitPatch(), [42], expected_stderr=expected_stderr)
 
     def test_edit_changelog(self):
         self.assert_execute_outputs(EditChangeLog(), [])
diff --git a/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py b/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py
index d570d40..3dbbdbb 100644
--- a/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py
+++ b/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py
@@ -183,7 +183,7 @@ class MockUser(object):
     def page(self, message):
         pass
 
-    def confirm(self):
+    def confirm(self, message=None):
         return True
 
 
diff --git a/WebKitTools/Scripts/webkitpy/user.py b/WebKitTools/Scripts/webkitpy/user.py
index 6be8905..c46ccfb 100644
--- a/WebKitTools/Scripts/webkitpy/user.py
+++ b/WebKitTools/Scripts/webkitpy/user.py
@@ -45,6 +45,8 @@ class User(object):
         except IOError, e:
             pass
 
-    def confirm(self):
-        response = raw_input("\nContinue? [Y/n]: ")
+    def confirm(self, message=None):
+        if not message:
+            message = "Continue?"
+        response = raw_input("%s [Y/n]: " % message)
         return not response or response.lower() == "y"

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list