[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 13:49:53 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 9ab03757256447965db36e1d784b0124a8d6a3f0
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 28 00:14:21 2010 +0000

    2010-09-27  Eric Seidel  <eric at webkit.org>
    
            Reviewed by Adam Barth.
    
            queue-status should report when the patch was last locked to a queue
            https://bugs.webkit.org/show_bug.cgi?id=46674
    
            This isn't necessarily the best way to expose this information
            but having this accessible via the web interface is very
            useful until we come up with a nicer way to display this.
    
            I also cleaned up the code in activeworkitems.py a little
            to use list comprehensions and to have the code work with
            pairs instead of two lists at once.  Eventually I think those
            item/time pairs need to be their own little helper class.
    
            * QueueStatusServer/handlers/queuestatus.py:
            * QueueStatusServer/model/activeworkitems.py:
            * QueueStatusServer/templates/queuestatus.html:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68453 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 13b5632..83979cb 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,23 @@
+2010-09-27  Eric Seidel  <eric at webkit.org>
+
+        Reviewed by Adam Barth.
+
+        queue-status should report when the patch was last locked to a queue
+        https://bugs.webkit.org/show_bug.cgi?id=46674
+
+        This isn't necessarily the best way to expose this information
+        but having this accessible via the web interface is very
+        useful until we come up with a nicer way to display this.
+
+        I also cleaned up the code in activeworkitems.py a little
+        to use list comprehensions and to have the code work with
+        pairs instead of two lists at once.  Eventually I think those
+        item/time pairs need to be their own little helper class.
+
+        * QueueStatusServer/handlers/queuestatus.py:
+        * QueueStatusServer/model/activeworkitems.py:
+        * QueueStatusServer/templates/queuestatus.html:
+
 2010-09-27  Tony Chang  <tony at chromium.org>
 
         Reviewed by David Levin.
diff --git a/WebKitTools/QueueStatusServer/handlers/queuestatus.py b/WebKitTools/QueueStatusServer/handlers/queuestatus.py
index f76157d..0259c37 100644
--- a/WebKitTools/QueueStatusServer/handlers/queuestatus.py
+++ b/WebKitTools/QueueStatusServer/handlers/queuestatus.py
@@ -31,24 +31,27 @@ from google.appengine.ext.webapp import template
 
 from model.queues import queues, display_name_for_queue
 from model.workitems import WorkItems
+from model.activeworkitems import ActiveWorkItems
 
 from model import queuestatus
 
 
 class QueueStatus(webapp.RequestHandler):
-    def _rows_for_work_items(self, work_items):
-        if not work_items:
+    def _rows_for_work_items(self, queued_items, active_items):
+        if not queued_items:
             return []
         rows = []
-        for item_id in work_items.item_ids:
+        for item_id in queued_items.item_ids:
             rows.append({
                 "attachment_id": item_id,
                 "bug_id": 1,
+                "lock_time": active_items and active_items.time_for_item(item_id),
             })
         return rows
 
     def get(self, queue_name):
-        work_items = WorkItems.all().filter("queue_name =", queue_name).get()
+        queued_items = WorkItems.all().filter("queue_name =", queue_name).get()
+        active_items = ActiveWorkItems.all().filter("queue_name =", queue_name).get()
         statuses = queuestatus.QueueStatus.all().filter("queue_name =", queue_name).order("-date").fetch(15)
 
         status_groups = []
@@ -67,7 +70,7 @@ class QueueStatus(webapp.RequestHandler):
 
         template_values = {
             "display_queue_name": display_name_for_queue(queue_name),
-            "work_item_rows": self._rows_for_work_items(work_items),
+            "work_item_rows": self._rows_for_work_items(queued_items, active_items),
             "status_groups": status_groups,
         }
         self.response.out.write(template.render("templates/queuestatus.html", template_values))
diff --git a/WebKitTools/QueueStatusServer/model/activeworkitems.py b/WebKitTools/QueueStatusServer/model/activeworkitems.py
index e24e6ca..3999c92 100644
--- a/WebKitTools/QueueStatusServer/model/activeworkitems.py
+++ b/WebKitTools/QueueStatusServer/model/activeworkitems.py
@@ -28,7 +28,7 @@
 
 from google.appengine.ext import db
 
-from datetime import timedelta
+from datetime import timedelta, datetime
 import time
 
 
@@ -38,21 +38,35 @@ class ActiveWorkItems(db.Model):
     item_dates = db.ListProperty(float)
     date = db.DateTimeProperty(auto_now_add=True)
 
+    # The id/date pairs should probably just be their own class.
+    def _item_time_pairs(self):
+        return zip(self.item_ids, self.item_dates)
+
+    def _set_item_time_pairs(self, pairs):
+        if not pairs:
+            self.item_ids = []
+            self.item_dates = []
+            return
+        self.item_ids, self.item_dates = zip(*pairs)
+
+    def _append_item_time_pair(self, pair):
+        self.item_ids.append(pair[0])
+        self.item_dates.append(pair[1])
+
     def deactivate_expired(self, now):
         one_hour_ago = time.mktime((now - timedelta(minutes=60)).timetuple())
-        nonexpired_item_ids = []
-        nonexpired_item_dates = []
-        for i in range(len(self.item_ids)):
-            if self.item_dates[i] > one_hour_ago:
-                nonexpired_item_ids.append(self.item_ids[i])
-                nonexpired_item_dates.append(self.item_dates[i])
-        self.item_ids = nonexpired_item_ids
-        self.item_dates = nonexpired_item_dates
+        nonexpired_pairs = [pair for pair in self._item_time_pairs() if pair[1] > one_hour_ago]
+        self._set_item_time_pairs(nonexpired_pairs)
 
     def next_item(self, work_item_ids, now):
         for item_id in work_item_ids:
             if item_id not in self.item_ids:
-                self.item_ids.append(item_id)
-                self.item_dates.append(time.mktime(now.timetuple()))
+                self._append_item_time_pair([item_id, time.mktime(now.timetuple())])
                 return item_id
         return None
+
+    def time_for_item(self, item_id):
+        for active_item_id, time in self._item_time_pairs():
+            if active_item_id == item_id:
+                return datetime.fromtimestamp(time)
+        return None
diff --git a/WebKitTools/QueueStatusServer/templates/queuestatus.html b/WebKitTools/QueueStatusServer/templates/queuestatus.html
index d2d72c7..fbcdfeb 100644
--- a/WebKitTools/QueueStatusServer/templates/queuestatus.html
+++ b/WebKitTools/QueueStatusServer/templates/queuestatus.html
@@ -42,13 +42,18 @@
 
 <h3>Patches in queue</h3>
 <table>
-    <tr><th>Position</th><th>Patch</th></tr>
+    <tr><th>Position</th><th>Patch</th><th>Last Activity</th></tr>
     {% for row in work_item_rows %}
     <tr>
         <td>#{{ forloop.counter }}</td>
         <td>
           {{ row.attachment_id|force_escape|webkit_attachment_id|safe }}
         </td>
+        <td>
+            {% if row.lock_time %}
+                {{ row.lock_time|timesince }} ago
+            {% endif %}
+        </td>
     </tr>
     {% endfor %}
 </table>

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list