[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

eric at webkit.org eric at webkit.org
Thu Feb 4 21:29:22 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 9b830b8811d17ab48c2b2ad3d03cd000757a96c7
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 27 13:01:03 2010 +0000

    2010-01-27  Eric Seidel  <eric at webkit.org>
    
            Reviewed by Darin Adler.
    
            webkit-patch needs an open-bugs command
            https://bugs.webkit.org/show_bug.cgi?id=30793
    
            * Scripts/test-webkitpy: import OpenBugsTest
            * Scripts/webkit-patch: import OpenBugs
            * Scripts/webkitpy/commands/download_unittest.py: don't import unittest
            * Scripts/webkitpy/commands/early_warning_system_unittest.py: ditto
            * Scripts/webkitpy/commands/queries_unittest.py: ditto
            * Scripts/webkitpy/commands/queues_unittest.py: ditto
            * Scripts/webkitpy/commands/upload_unittest.py: ditto
            * Scripts/webkitpy/mock_bugzillatool.py: log when user.open_url is called.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53925 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 8742c0d..b2372df 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,19 @@
+2010-01-27  Eric Seidel  <eric at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        webkit-patch needs an open-bugs command
+        https://bugs.webkit.org/show_bug.cgi?id=30793
+
+        * Scripts/test-webkitpy: import OpenBugsTest
+        * Scripts/webkit-patch: import OpenBugs
+        * Scripts/webkitpy/commands/download_unittest.py: don't import unittest
+        * Scripts/webkitpy/commands/early_warning_system_unittest.py: ditto
+        * Scripts/webkitpy/commands/queries_unittest.py: ditto
+        * Scripts/webkitpy/commands/queues_unittest.py: ditto
+        * Scripts/webkitpy/commands/upload_unittest.py: ditto
+        * Scripts/webkitpy/mock_bugzillatool.py: log when user.open_url is called.
+
 2010-01-27  Kenneth Rohde Christiansen  <kenneth at webkit.org>
 
         Rubberstamped by Simon Hausmann
diff --git a/WebKitTools/Scripts/test-webkitpy b/WebKitTools/Scripts/test-webkitpy
index eaccd58..ca58b50 100755
--- a/WebKitTools/Scripts/test-webkitpy
+++ b/WebKitTools/Scripts/test-webkitpy
@@ -35,6 +35,7 @@ from webkitpy.buildbot_unittest import *
 from webkitpy.changelogs_unittest import *
 from webkitpy.commands.download_unittest import *
 from webkitpy.commands.early_warning_system_unittest import *
+from webkitpy.commands.openbugs_unittest import OpenBugsTest
 from webkitpy.commands.upload_unittest import *
 from webkitpy.commands.queries_unittest import *
 from webkitpy.commands.queues_unittest import *
diff --git a/WebKitTools/Scripts/webkit-patch b/WebKitTools/Scripts/webkit-patch
index 46e8bff..b4bcc4c 100755
--- a/WebKitTools/Scripts/webkit-patch
+++ b/WebKitTools/Scripts/webkit-patch
@@ -36,6 +36,7 @@ from webkitpy.bugzilla import Bugzilla
 from webkitpy.buildbot import BuildBot
 from webkitpy.commands.download import *
 from webkitpy.commands.early_warning_system import *
+from webkitpy.commands.openbugs import OpenBugs
 from webkitpy.commands.queries import *
 from webkitpy.commands.queues import *
 from webkitpy.commands.upload import *
diff --git a/WebKitTools/Scripts/webkitpy/commands/download_unittest.py b/WebKitTools/Scripts/webkitpy/commands/download_unittest.py
index 9959b60..f60c5b8 100644
--- a/WebKitTools/Scripts/webkitpy/commands/download_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/commands/download_unittest.py
@@ -26,8 +26,6 @@
 # (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.commandtest import CommandsTest
 from webkitpy.commands.download import *
 from webkitpy.mock import Mock
diff --git a/WebKitTools/Scripts/webkitpy/commands/early_warning_system_unittest.py b/WebKitTools/Scripts/webkitpy/commands/early_warning_system_unittest.py
index dec8981..d516b84 100644
--- a/WebKitTools/Scripts/webkitpy/commands/early_warning_system_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/commands/early_warning_system_unittest.py
@@ -27,7 +27,6 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import os
-import unittest
 
 from webkitpy.commands.early_warning_system import *
 from webkitpy.commands.queuestest import QueuesTest
diff --git a/WebKitTools/Scripts/webkitpy/commands/openbugs.py b/WebKitTools/Scripts/webkitpy/commands/openbugs.py
new file mode 100644
index 0000000..25bdefc
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/commands/openbugs.py
@@ -0,0 +1,63 @@
+# 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 re
+import sys
+
+from webkitpy.multicommandtool import AbstractDeclarativeCommand
+from webkitpy.webkit_logging import log
+
+
+class OpenBugs(AbstractDeclarativeCommand):
+    name = "open-bugs"
+    help_text = "Finds all bug numbers passed in arguments (or stdin if no args provided) and opens them in a web browser"
+
+    bug_number_regexp = re.compile(r"\b\d{4,6}\b")
+
+    def _open_bugs(self, bug_ids):
+        for bug_id in bug_ids:
+            bug_url = self.tool.bugs.bug_url_for_bug_id(bug_id)
+            self.tool.user.open_url(bug_url)
+
+    # _find_bugs_in_string mostly exists for easy unit testing.
+    def _find_bugs_in_string(self, string):
+        return self.bug_number_regexp.findall(string)
+
+    def _find_bugs_in_iterable(self, iterable):
+        return sum([self._find_bugs_in_string(string) for string in iterable], [])
+
+    def execute(self, options, args, tool):
+        if args:
+            bug_ids = self._find_bugs_in_iterable(args)
+        else:
+            # This won't open bugs until stdin is closed but could be made to easily.  That would just make unit testing slightly harder.
+            bug_ids = self._find_bugs_in_iterable(sys.stdin)
+
+        log("%s bugs found in input." % len(bug_ids))
+
+        self._open_bugs(bug_ids)
diff --git a/WebKitTools/Scripts/webkitpy/commands/openbugs_unittest.py b/WebKitTools/Scripts/webkitpy/commands/openbugs_unittest.py
new file mode 100644
index 0000000..71fefd2
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/commands/openbugs_unittest.py
@@ -0,0 +1,50 @@
+# Copyright (C) 2009 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.commands.commandtest import CommandsTest
+from webkitpy.commands.openbugs import OpenBugs
+
+class OpenBugsTest(CommandsTest):
+
+    find_bugs_in_string_expectations = [
+        ["123", []],
+        ["1234", ["1234"]],
+        ["12345", ["12345"]],
+        ["123456", ["123456"]],
+        ["1234567", []],
+        [" 123456 234567", ["123456", "234567"]],
+    ]
+
+    def test_find_bugs_in_string(self):
+        openbugs = OpenBugs()
+        for expectation in self.find_bugs_in_string_expectations:
+            self.assertEquals(openbugs._find_bugs_in_string(expectation[0]), expectation[1])
+
+    def test_args_parsing(self):
+        expected_stderr = "2 bugs found in input.\nMOCK: user.open_url: http://example.com/12345\nMOCK: user.open_url: http://example.com/23456\n"
+        self.assert_execute_outputs(OpenBugs(), ["12345\n23456"], expected_stderr=expected_stderr)
diff --git a/WebKitTools/Scripts/webkitpy/commands/queries_unittest.py b/WebKitTools/Scripts/webkitpy/commands/queries_unittest.py
index 9a14f9b..b858777 100644
--- a/WebKitTools/Scripts/webkitpy/commands/queries_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/commands/queries_unittest.py
@@ -26,8 +26,6 @@
 # (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.bugzilla import Bugzilla
 from webkitpy.commands.commandtest import CommandsTest
 from webkitpy.commands.queries import *
diff --git a/WebKitTools/Scripts/webkitpy/commands/queues_unittest.py b/WebKitTools/Scripts/webkitpy/commands/queues_unittest.py
index 1aa5481..87cd645 100644
--- a/WebKitTools/Scripts/webkitpy/commands/queues_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/commands/queues_unittest.py
@@ -27,7 +27,6 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import os
-import unittest
 
 from webkitpy.commands.commandtest import CommandsTest
 from webkitpy.commands.queues import *
diff --git a/WebKitTools/Scripts/webkitpy/commands/upload_unittest.py b/WebKitTools/Scripts/webkitpy/commands/upload_unittest.py
index 12313d0..33001ac 100644
--- a/WebKitTools/Scripts/webkitpy/commands/upload_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/commands/upload_unittest.py
@@ -26,8 +26,6 @@
 # (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.commandtest import CommandsTest
 from webkitpy.commands.upload import *
 from webkitpy.mock import Mock
@@ -67,7 +65,7 @@ class UploadCommandsTest(CommandsTest):
         self.assert_execute_outputs(Prepare(), [])
 
     def test_upload(self):
-        expected_stderr = "Running check-webkit-style\nObsoleting 2 old patches on bug 42\n"
+        expected_stderr = "Running check-webkit-style\nObsoleting 2 old patches on bug 42\nMOCK: user.open_url: http://example.com/42\n"
         self.assert_execute_outputs(Upload(), [42], expected_stderr=expected_stderr)
 
     def test_mark_bug_fixed(self):
@@ -75,7 +73,11 @@ class UploadCommandsTest(CommandsTest):
         tool._scm.last_svn_commit_log = lambda: "r9876 |"
         options = Mock()
         options.bug_id = 42
-        expected_stderr = "Bug: <http://example.com/42> Bug with two r+'d and cq+'d patches, one of which has an invalid commit-queue setter.\nRevision: 9876\nAdding comment to Bug 42.\n"
+        expected_stderr = """Bug: <http://example.com/42> Bug with two r+'d and cq+'d patches, one of which has an invalid commit-queue setter.
+Revision: 9876
+MOCK: user.open_url: http://example.com/42
+Adding comment to Bug 42.
+"""
         self.assert_execute_outputs(MarkBugFixed(), [], expected_stderr=expected_stderr, tool=tool, options=options)
 
     def test_edit_changelog(self):
diff --git a/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py b/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py
index b5fc835..1aff53a 100644
--- a/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py
+++ b/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py
@@ -28,10 +28,11 @@
 
 import os
 
+from webkitpy.bugzilla import Bug, Attachment
+from webkitpy.committers import CommitterList, Reviewer
 from webkitpy.mock import Mock
 from webkitpy.scm import CommitMessage
-from webkitpy.committers import CommitterList, Reviewer
-from webkitpy.bugzilla import Bug, Attachment
+from webkitpy.webkit_logging import log
 
 
 def _id_to_object_dictionary(*objects):
@@ -333,6 +334,7 @@ class MockUser(object):
         return True
 
     def open_url(self, url):
+        log("MOCK: user.open_url: %s" % url)
         pass
 
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list