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


The following commit has been merged in the webkit-1.2 branch:
commit 264d17e0784a071d81e26f2748caaa92441ff929
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jan 11 16:50:07 2010 +0000

    2010-01-10  Adam Barth  <abarth at webkit.org>
    
            Reviewed by David Kilzer.
    
            bugzilla-tool submit-patch mistakenly picks up bug URLs in non-ChangeLog files
            https://bugs.webkit.org/show_bug.cgi?id=33197
    
            We should just search for bug numbers in the ChangeLogs instead of in
            the whole diff.
    
            * Scripts/test-webkitpy:
            * Scripts/webkitpy/commands/abstractdiffcommand.py: Added.
            * Scripts/webkitpy/commands/abstractdiffcommand_unittest.py: Added.
            * Scripts/webkitpy/commands/download.py:
            * Scripts/webkitpy/commands/upload.py:
            * Scripts/webkitpy/mock_bugzillatool.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53079 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index b807717..25b96ea 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,20 @@
+2010-01-10  Adam Barth  <abarth at webkit.org>
+
+        Reviewed by David Kilzer.
+
+        bugzilla-tool submit-patch mistakenly picks up bug URLs in non-ChangeLog files
+        https://bugs.webkit.org/show_bug.cgi?id=33197
+
+        We should just search for bug numbers in the ChangeLogs instead of in
+        the whole diff.
+ 
+        * Scripts/test-webkitpy:
+        * Scripts/webkitpy/commands/abstractdiffcommand.py: Added.
+        * Scripts/webkitpy/commands/abstractdiffcommand_unittest.py: Added.
+        * Scripts/webkitpy/commands/download.py:
+        * Scripts/webkitpy/commands/upload.py:
+        * Scripts/webkitpy/mock_bugzillatool.py:
+
 2010-01-11  Chris Jerdonek  <chris.jerdonek at gmail.com>
 
         Reviewed by David Kilzer.
diff --git a/WebKitTools/Scripts/test-webkitpy b/WebKitTools/Scripts/test-webkitpy
index f320eeb..6e5e0ef 100755
--- a/WebKitTools/Scripts/test-webkitpy
+++ b/WebKitTools/Scripts/test-webkitpy
@@ -33,6 +33,7 @@ import unittest
 from webkitpy.bugzilla_unittest import *
 from webkitpy.buildbot_unittest import *
 from webkitpy.changelogs_unittest import *
+from webkitpy.commands.abstractdiffcommand_unittest import *
 from webkitpy.commands.download_unittest import *
 from webkitpy.commands.early_warning_system_unittest import *
 from webkitpy.commands.upload_unittest import *
diff --git a/WebKitTools/Scripts/webkitpy/commands/abstractdiffcommand.py b/WebKitTools/Scripts/webkitpy/commands/abstractdiffcommand.py
new file mode 100644
index 0000000..1563233
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/commands/abstractdiffcommand.py
@@ -0,0 +1,39 @@
+# Copyright (C) 2010 Google 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.
+
+from webkitpy.bugzilla import parse_bug_id
+from webkitpy.commands.abstractsequencedcommand import AbstractSequencedCommand
+
+
+class AbstractDiffCommand(AbstractSequencedCommand):
+    def _bug_id(self, args, tool):
+        # Perfer a bug id passed as an argument over a bug URL in the ChangeLogs.
+        bug_id = args and args[0]
+        if not bug_id:
+            bug_id = parse_bug_id(tool.scm().commit_message_for_this_commit().message())
+        return bug_id
diff --git a/WebKitTools/Scripts/webkitpy/commands/abstractdiffcommand_unittest.py b/WebKitTools/Scripts/webkitpy/commands/abstractdiffcommand_unittest.py
new file mode 100644
index 0000000..8777b87
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/commands/abstractdiffcommand_unittest.py
@@ -0,0 +1,36 @@
+# Copyright (C) 2010 Google 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 unittest
+
+from webkitpy.commands.abstractdiffcommand import AbstractDiffCommand
+from webkitpy.mock_bugzillatool import MockBugzillaTool
+
+class AbstractDiffCommandTest(unittest.TestCase):
+    def test_bug_id(self):
+        self.assertEquals(AbstractDiffCommand()._bug_id(None, MockBugzillaTool()), 93)
diff --git a/WebKitTools/Scripts/webkitpy/commands/download.py b/WebKitTools/Scripts/webkitpy/commands/download.py
index bb8c01a..3b7b2bf 100644
--- a/WebKitTools/Scripts/webkitpy/commands/download.py
+++ b/WebKitTools/Scripts/webkitpy/commands/download.py
@@ -36,6 +36,7 @@ import webkitpy.steps as steps
 from webkitpy.bugzilla import parse_bug_id
 # We could instead use from modules import buildsteps and then prefix every buildstep with "buildsteps."
 from webkitpy.changelogs import ChangeLog
+from webkitpy.commands.abstractdiffcommand import AbstractDiffCommand
 from webkitpy.commands.abstractsequencedcommand import AbstractSequencedCommand
 from webkitpy.comments import bug_comment_from_commit_text
 from webkitpy.executive import ScriptError
@@ -66,7 +67,7 @@ class BuildAndTest(AbstractSequencedCommand):
     ]
 
 
-class Land(AbstractSequencedCommand):
+class Land(AbstractDiffCommand):
     name = "land"
     help_text = "Land the current working directory diff and updates the associated bug if any"
     argument_names = "[BUGID]"
@@ -88,7 +89,7 @@ If a bug id is provided, or one can be found in the ChangeLog land will update t
         return {
             "patch" : {
                 "id" : None,
-                "bug_id" : (args and args[0]) or parse_bug_id(tool.scm().create_patch()),
+                "bug_id" : self._bug_id(args, tool),
             }
         }
 
@@ -268,6 +269,7 @@ Commits the revert and updates the bug (including re-opening the bug if necessar
     @staticmethod
     def _parse_bug_id_from_revision_diff(tool, revision):
         original_diff = tool.scm().diff_for_revision(revision)
+        # FIXME: This is wrong because it picks up bug numbers outside of ChangeLogs
         return parse_bug_id(original_diff)
 
     def execute(self, options, args, tool):
diff --git a/WebKitTools/Scripts/webkitpy/commands/upload.py b/WebKitTools/Scripts/webkitpy/commands/upload.py
index 65f6b39..9e7636a 100644
--- a/WebKitTools/Scripts/webkitpy/commands/upload.py
+++ b/WebKitTools/Scripts/webkitpy/commands/upload.py
@@ -38,6 +38,7 @@ from optparse import make_option
 import webkitpy.steps as steps
 
 from webkitpy.bugzilla import parse_bug_id
+from webkitpy.commands.abstractdiffcommand import AbstractDiffCommand
 from webkitpy.commands.abstractsequencedcommand import AbstractSequencedCommand
 from webkitpy.comments import bug_comment_from_svn_revision
 from webkitpy.committers import CommitterList
@@ -99,17 +100,7 @@ class ObsoleteAttachments(AbstractSequencedCommand):
         return { "bug_id" : args[0] }
 
 
-class AbstractPatchUploadingCommand(AbstractSequencedCommand):
-    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 Post(AbstractPatchUploadingCommand):
+class Post(AbstractDiffCommand):
     name = "post"
     help_text = "Attach the current working directory diff to a bug as a patch file"
     argument_names = "[BUGID]"
@@ -122,8 +113,7 @@ class Post(AbstractPatchUploadingCommand):
     ]
 
     def _prepare_state(self, options, args, tool):
-        state = {}
-        state["bug_id"] = self._bug_id(args, tool, state)
+        state = { "bug_id" : self._bug_id(args, tool) }
         if not state["bug_id"]:
             error("No bug id passed and no bug url found in diff, can't post.")
         return state
@@ -145,7 +135,7 @@ class Prepare(AbstractSequencedCommand):
         return { "bug_id" : bug_id }
 
 
-class Upload(AbstractPatchUploadingCommand):
+class Upload(AbstractDiffCommand):
     name = "upload"
     help_text = "Automates the process of uploading a patch for review"
     argument_names = "[BUGID]"
@@ -169,8 +159,7 @@ class Upload(AbstractPatchUploadingCommand):
     command in the PAGER environment variable."""
 
     def _prepare_state(self, options, args, tool):
-        state = {}
-        state["bug_id"] = self._bug_id(args, tool, state)
+        state = { "bug_id" : self._bug_id(args, tool) }
         return state
 
 
diff --git a/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py b/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py
index f8392aa..ee5a3c8 100644
--- a/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py
+++ b/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py
@@ -156,11 +156,14 @@ class MockSCM(Mock):
     def commit_ids_from_commitish_arguments(self, args):
         return ["Commitish1", "Commitish2"]
 
+    def commit_message_for_this_commit(self):
+        return CommitMessage(["CommitMessage1", "https://bugs.webkit.org/show_bug.cgi?id=93"])
+
     def commit_message_for_local_commit(self, commit_id):
         if commit_id == "Commitish1":
-            return CommitMessage("CommitMessage1\nhttps://bugs.example.org/show_bug.cgi?id=42\n")
+            return CommitMessage(["CommitMessage1", "https://bugs.webkit.org/show_bug.cgi?id=42"])
         if commit_id == "Commitish2":
-            return CommitMessage("CommitMessage2\nhttps://bugs.example.org/show_bug.cgi?id=75\n")
+            return CommitMessage(["CommitMessage2", "https://bugs.webkit.org/show_bug.cgi?id=75"])
         raise Exception("Bogus commit_id in commit_message_for_local_commit.")
 
     def create_patch_from_local_commit(self, commit_id):

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list