[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

eric at webkit.org eric at webkit.org
Wed Dec 22 14:54:27 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 20be8493e9599ee162a25151dadb43dc13c0388d
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Oct 24 04:44:57 2010 +0000

    2010-10-23  Eric Seidel  <eric at webkit.org>
    
            Reviewed by Adam Barth.
    
            EWS never removes invalid patch ids
            https://bugs.webkit.org/show_bug.cgi?id=48173
    
            This is just sticking another finger in the dam.
            However this adds more unit testing which will help
            us make sure we're always releasing patches once we
            redesign the release_patch API and call these from
            a more central place.
    
            * Scripts/webkitpy/tool/commands/queues.py:
            * Scripts/webkitpy/tool/commands/queues_unittest.py:
            * Scripts/webkitpy/tool/mocktool.py:
             - Added the ability to request invalid patches.
               Log a warning message to make sure we don't ever have
               tests use invalid patch fetches by mistake.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70409 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 8f43b20..2c0df1a 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,23 @@
+2010-10-23  Eric Seidel  <eric at webkit.org>
+
+        Reviewed by Adam Barth.
+
+        EWS never removes invalid patch ids
+        https://bugs.webkit.org/show_bug.cgi?id=48173
+
+        This is just sticking another finger in the dam.
+        However this adds more unit testing which will help
+        us make sure we're always releasing patches once we
+        redesign the release_patch API and call these from
+        a more central place.
+
+        * Scripts/webkitpy/tool/commands/queues.py:
+        * Scripts/webkitpy/tool/commands/queues_unittest.py:
+        * Scripts/webkitpy/tool/mocktool.py:
+         - Added the ability to request invalid patches.
+           Log a warning message to make sure we don't ever have
+           tests use invalid patch fetches by mistake.
+
 2010-10-23  Dan Bernstein  <mitz at apple.com>
 
         Build fix. Add stub implementations for required NSDraggingInfo methods.
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/queues.py b/WebKitTools/Scripts/webkitpy/tool/commands/queues.py
index d6efeb4..560cb1d 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/queues.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/queues.py
@@ -38,7 +38,7 @@ from datetime import datetime
 from optparse import make_option
 from StringIO import StringIO
 
-from webkitpy.common.net.bugzilla import CommitterValidator
+from webkitpy.common.net.bugzilla import CommitterValidator, Attachment
 from webkitpy.common.net.layouttestresults import path_for_layout_test, LayoutTestResults
 from webkitpy.common.net.statusserver import StatusServer
 from webkitpy.common.system.executive import ScriptError
@@ -201,8 +201,20 @@ class AbstractPatchQueue(AbstractQueue):
     def _update_status(self, message, patch=None, results_file=None):
         return self._tool.status_server.update_status(self.name, message, patch, results_file)
 
-    def _fetch_next_work_item(self):
-        return self._tool.status_server.next_work_item(self.name)
+    def _next_patch(self):
+        patch_id = self._tool.status_server.next_work_item(self.name)
+        if not patch_id:
+            return None
+        patch = self._tool.bugs.fetch_attachment(patch_id)
+        if not patch:
+            # FIXME: Using a fake patch because release_work_item has the wrong API.
+            # We also don't really need to release the lock (although that's fine),
+            # mostly we just need to remove this bogus patch from our queue.
+            # If for some reason bugzilla is just down, then it will be re-fed later.
+            patch = Attachment({'id': patch_id}, None)
+            self._release_work_item(patch)
+            return None
+        return patch
 
     def _release_work_item(self, patch):
         self._tool.status_server.release_work_item(self.name, patch)
@@ -238,10 +250,7 @@ class CommitQueue(AbstractPatchQueue, StepSequenceErrorHandler, CommitQueueTaskD
         self.committer_validator = CommitterValidator(self._tool.bugs)
 
     def next_work_item(self):
-        patch_id = self._fetch_next_work_item()
-        if not patch_id:
-            return None
-        return self._tool.bugs.fetch_attachment(patch_id)
+        return self._next_patch()
 
     def should_proceed_with_work_item(self, patch):
         patch_text = "rollout patch" if patch.is_rollout() else "patch"
@@ -395,10 +404,7 @@ class AbstractReviewQueue(AbstractPatchQueue, StepSequenceErrorHandler):
         AbstractPatchQueue.begin_work_queue(self)
 
     def next_work_item(self):
-        patch_id = self._fetch_next_work_item()
-        if not patch_id:
-            return None
-        return self._tool.bugs.fetch_attachment(patch_id)
+        return self._next_patch()
 
     def should_proceed_with_work_item(self, patch):
         raise NotImplementedError("subclasses must implement")
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py b/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py
index f0d220f..7f2480e 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py
@@ -139,15 +139,19 @@ MOCK: submit_to_ews: 103
 
 
 class AbstractPatchQueueTest(CommandsTest):
-    def test_fetch_next_work_item(self):
+    def test_next_patch(self):
         queue = AbstractPatchQueue()
         tool = MockTool()
         queue.bind_to_tool(tool)
         queue._options = Mock()
         queue._options.port = None
-        self.assertEquals(queue._fetch_next_work_item(), None)
-        tool.status_server = MockStatusServer(work_items=[2, 1, 3])
-        self.assertEquals(queue._fetch_next_work_item(), 2)
+        self.assertEquals(queue._next_patch(), None)
+        tool.status_server = MockStatusServer(work_items=[2, 197])
+        expected_stdout = "MOCK: fetch_attachment: 2 is not a known attachment id\n"  # A mock-only message to prevent us from making mistakes.
+        expected_stderr = "MOCK: release_work_item: None 2\n"
+        patch_id = OutputCapture().assert_outputs(self, queue._next_patch, [], expected_stdout=expected_stdout, expected_stderr=expected_stderr)
+        self.assertEquals(patch_id, None)  # 2 is an invalid patch id
+        self.assertEquals(queue._next_patch().id(), 197)
 
 
 class NeedsUpdateSequence(StepSequence):
diff --git a/WebKitTools/Scripts/webkitpy/tool/mocktool.py b/WebKitTools/Scripts/webkitpy/tool/mocktool.py
index 0970930..093bec2 100644
--- a/WebKitTools/Scripts/webkitpy/tool/mocktool.py
+++ b/WebKitTools/Scripts/webkitpy/tool/mocktool.py
@@ -292,8 +292,10 @@ class MockBugzilla(Mock):
         if self._override_patch:
             return self._override_patch
 
-        # This could be changed to .get() if we wish to allow failed lookups.
-        attachment_dictionary = self.attachment_cache[attachment_id]
+        attachment_dictionary = self.attachment_cache.get(attachment_id)
+        if not attachment_dictionary:
+            print "MOCK: fetch_attachment: %s is not a known attachment id" % attachment_id
+            return None
         bug = self.fetch_bug(attachment_dictionary["bug_id"])
         for attachment in bug.attachments(include_obsolete=True):
             if attachment.id() == int(attachment_id):
@@ -553,7 +555,7 @@ class MockStatusServer(object):
     def next_work_item(self, queue_name):
         if not self._work_items:
             return None
-        return self._work_items[0]
+        return self._work_items.pop(0)
 
     def release_work_item(self, queue_name, patch):
         log("MOCK: release_work_item: %s %s" % (queue_name, patch.id()))

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list