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

abarth at webkit.org abarth at webkit.org
Wed Apr 7 23:43:25 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit c0f896c112f6f47620651ea5272619345dc1ad15
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 16 13:05:10 2009 +0000

    2009-11-16  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Eric Seidel.
    
            Convert CommitQueue over to PatchCollection
            https://bugs.webkit.org/show_bug.cgi?id=31547
    
            Also fixes a bug in workqueue and adds a test!
    
            * Scripts/bugzilla-tool:
            * Scripts/modules/workqueue.py:
            * Scripts/modules/workqueue_unittest.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51031 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 5396f84..0e931b5 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -2,6 +2,19 @@
 
         Reviewed by Eric Seidel.
 
+        Convert CommitQueue over to PatchCollection
+        https://bugs.webkit.org/show_bug.cgi?id=31547
+
+        Also fixes a bug in workqueue and adds a test!
+
+        * Scripts/bugzilla-tool:
+        * Scripts/modules/workqueue.py:
+        * Scripts/modules/workqueue_unittest.py:
+
+2009-11-16  Adam Barth  <abarth at webkit.org>
+
+        Reviewed by Eric Seidel.
+
         Move StyleQueue over to using PatchCollection
         https://bugs.webkit.org/show_bug.cgi?id=31544
 
diff --git a/WebKitTools/Scripts/bugzilla-tool b/WebKitTools/Scripts/bugzilla-tool
index 7a61df8..223deef 100755
--- a/WebKitTools/Scripts/bugzilla-tool
+++ b/WebKitTools/Scripts/bugzilla-tool
@@ -766,29 +766,32 @@ class CommitQueue(AbstractQueue):
     def __init__(self):
         AbstractQueue.__init__(self, "commit-queue")
 
+    def begin_work_queue(self):
+        AbstractQueue.begin_work_queue(self)
+        self._patches = PatchCollection(self.tool.bugs)
+
     def next_work_item(self):
-        # Fetch patches instead of just bug ids to that we validate reviewer/committer flags on every patch.
-        patches = self.tool.bugs.fetch_patches_from_commit_queue(reject_invalid_patches=True)
-        if not len(patches):
-            return None
-        patch_ids = map(lambda patch: patch['id'], patches)
-        log("%s in commit queue [%s]" % (pluralize('patch', len(patches)), ", ".join(patch_ids)))
-        return patches[0]['bug_id']
+        if not len(self._patches):
+            # Fetch patches instead of just bug ids to that we validate reviewer/committer flags on every patch.
+            self._patches.add_patches(self.tool.bugs.fetch_patches_from_commit_queue(reject_invalid_patches=True))
+        self.log_progress(self._patches.patch_ids())
+        return self._patches.next()
 
-    def should_proceed_with_work_item(self, bug_id):
+    def should_proceed_with_work_item(self, patch):
         red_builders_names = self.tool.buildbot.red_core_builders_names()
         if red_builders_names:
             red_builders_names = map(lambda name: '"%s"' % name, red_builders_names) # Add quotes around the names.
             return (False, "Builders [%s] are red. See http://build.webkit.org." % ", ".join(red_builders_names), None)
-        return (True, "Landing patches from bug %s." % bug_id, bug_id)
+        return (True, "Landing patches from bug %s." % patch['bug_id'], patch['bug_id'])
 
-    def process_work_item(self, bug_id):
-        self.run_bugzilla_tool(['land-patches', '--force-clean', '--commit-queue', '--quiet', bug_id])
+    def process_work_item(self, patch):
+        self.run_bugzilla_tool(['land-patches', '--force-clean', '--commit-queue', '--quiet', patch['bug_id']])
 
-    def handle_unexpected_error(self, bug_id, message):
+    def handle_unexpected_error(self, patch, message):
         # We don't have a patch id at this point, so try to grab the first patch off
         # of the bug in question.  We plan to update the commit-queue to opearate
         # off of patch ids in the near future.
+        bug_id = patch['bug_id']
         patches = self.tool.bugs.fetch_commit_queue_patches_from_bug(bug_id)
         non_obsolete_patches = filter(lambda patch: not patch['is_obsolete'], patches)
         if not len(non_obsolete_patches):
diff --git a/WebKitTools/Scripts/modules/workqueue.py b/WebKitTools/Scripts/modules/workqueue.py
index 5698f05..8e71481 100644
--- a/WebKitTools/Scripts/modules/workqueue.py
+++ b/WebKitTools/Scripts/modules/workqueue.py
@@ -97,7 +97,7 @@ class WorkQueue:
                     continue
                 (safe_to_proceed, waiting_message, bug_id) = self._delegate.should_proceed_with_work_item(work_item)
                 if not safe_to_proceed:
-                    self._update_status_and_sleep(waiting_message, bug_ig=bug_id)
+                    self._update_status_and_sleep(waiting_message)
                     continue
                 self.status_bot.update_status(waiting_message, bug_id=bug_id)
             except Exception, e:
diff --git a/WebKitTools/Scripts/modules/workqueue_unittest.py b/WebKitTools/Scripts/modules/workqueue_unittest.py
index efaddbf..3428acc 100644
--- a/WebKitTools/Scripts/modules/workqueue_unittest.py
+++ b/WebKitTools/Scripts/modules/workqueue_unittest.py
@@ -95,6 +95,7 @@ class LoggingDelegate(WorkQueueDelegate):
         self.record("handle_unexpected_error")
         self._test.assertEquals(work_item, "work_item")
 
+
 class ThrowErrorDelegate(LoggingDelegate):
     def __init__(self, test, error_code):
         LoggingDelegate.__init__(self, test)
@@ -104,6 +105,25 @@ class ThrowErrorDelegate(LoggingDelegate):
         self.record("process_work_item")
         raise ScriptError(exit_code=self.error_code)
 
+
+class NotSafeToProceedDelegate(LoggingDelegate):
+    def should_proceed_with_work_item(self, work_item):
+        self.record("should_proceed_with_work_item")
+        self._test.assertEquals(work_item, "work_item")
+        return (False, "waiting_message", 42)
+
+
+class FastWorkQueue(WorkQueue):
+    def __init__(self, delegate):
+        WorkQueue.__init__(self, delegate)
+
+    # No sleep for the wicked.
+    seconds_to_sleep = 0
+
+    def _update_status_and_sleep(self, message):
+        pass
+
+
 class WorkQueueTest(unittest.TestCase):
     def test_trivial(self):
         delegate = LoggingDelegate(self)
@@ -130,6 +150,19 @@ class WorkQueueTest(unittest.TestCase):
         work_queue.run()
         self.assertEquals(delegate._callbacks, LoggingDelegate.expected_callbacks)
 
+    def test_not_safe_to_proceed(self):
+        delegate = NotSafeToProceedDelegate(self)
+        work_queue = FastWorkQueue(delegate)
+        work_queue.run()
+        expected_callbacks = LoggingDelegate.expected_callbacks[:]
+        next_work_item_index = expected_callbacks.index('next_work_item')
+        # We slice out the common part of the expected callbacks.
+        # We add 2 here to include should_proceed_with_work_item, which is
+        # a pain to search for directly because it occurs twice.
+        expected_callbacks = expected_callbacks[:next_work_item_index + 2]
+        expected_callbacks.append('should_continue_work_queue')
+        self.assertEquals(delegate._callbacks, expected_callbacks)
+
     def setUp(self):
         self.temp_dir = tempfile.mkdtemp(suffix="work_queue_test_logs")
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list