Title: [195658] trunk/Tools
Revision
195658
Author
[email protected]
Date
2016-01-26 23:43:50 -0800 (Tue, 26 Jan 2016)

Log Message

Sort incoming commits via date instead of revision number.
https://bugs.webkit.org/show_bug.cgi?id=153467

Reviewed by Alexey Proskuryakov.

Future Trac instances may use Git or other revision control systems where we cannnot rely on the revision number
for sorting revisions. Instead we use the commit date to sort revisions chronologically.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js:
(Trac.prototype._loaded): Sort via date instead of revision number.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/MockTrac.js:
(MockTrac): Fix up the mock data to look more like real-world data.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/test-fixture-trac-rss.xml: Added.
Fake RSS feed that adds three more commits.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/tests.js: Added unit tests to test
Trac._loaded().

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js (195657 => 195658)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js	2016-01-27 07:13:31 UTC (rev 195657)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js	2016-01-27 07:43:50 UTC (rev 195658)
@@ -195,7 +195,7 @@
         }
 
         if (newCommits.length)
-            this.recordedCommits = newCommits.concat(this.recordedCommits).sort(function(a, b) { return a.revisionNumber - b.revisionNumber; });
+            this.recordedCommits = newCommits.concat(this.recordedCommits).sort(function(a, b) { return a.date - b.date; });
 
         if (newCommits.length || knownCommitsWereUpdated)
             this.dispatchEventToListeners(Trac.Event.CommitsUpdated, null);

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/MockTrac.js (195657 => 195658)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/MockTrac.js	2016-01-27 07:13:31 UTC (rev 195657)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/MockTrac.js	2016-01-27 07:43:50 UTC (rev 195658)
@@ -29,50 +29,50 @@
     this.recordedCommits = [
         {
             "revisionNumber": 33018,
-            "link": "http://trac.webkit.org/repository/changeset/77018/safari",
-            "title": {},
-            "author": "John",
-            "date": "2015-11-15T17:05:44.000Z",
+            "link": "https://trac.webkit.org/changeset/33018",
+            "title": { innerHTML: "commit message" },
+            "author": "[email protected]",
+            "date": new Date("2015-11-15T17:05:44.000Z"),
             "description": "description",
             "containsBranchLocation": true,
             "branchName": "trunk"
         },
         {
             "revisionNumber": 33019,
-            "link": "http://trac.webkit.org/repository/changeset/77019/safari",
-            "title": {},
-            "author": "Paul",
-            "date": "2015-11-16T01:18:23.000Z",
+            "link": "https://trac.webkit.org/changeset/33019",
+            "title": { innerHTML: "commit message" },
+            "author": "[email protected]",
+            "date": new Date("2015-11-16T01:18:23.000Z"),
             "description": "description",
             "containsBranchLocation": true,
             "branchName": "trunk"
         },
         {
             "revisionNumber": 33020,
-            "link": "http://trac.webkit.org/repository/changeset/77020/safari",
-            "title": {},
-            "author": "George",
-            "date": "2015-11-16T01:19:27.000Z",
+            "link": "https://trac.webkit.org/changeset/33020",
+            "title": { innerHTML: "commit message" },
+            "author": "[email protected]",
+            "date": new Date("2015-11-16T01:19:27.000Z"),
             "description": "description",
             "containsBranchLocation": true,
             "branchName": "trunk"
         },
         {
             "revisionNumber": 33021,
-            "link": "http://trac.webkit.org/repository/changeset/77021/safari",
-            "title": {},
-            "author": "Ringo",
-            "date": "2015-11-16T01:20:58.000Z",
+            "link": "https://trac.webkit.org/changeset/33021",
+            "title": { innerHTML: "commit message" },
+            "author": "[email protected]",
+            "date": new Date("2015-11-16T01:20:58.000Z"),
             "description": "description",
             "containsBranchLocation": true,
             "branchName": "someOtherBranch"
         },
         {
             "revisionNumber": 33022,
-            "link": "http://trac.webkit.org/repository/changeset/77022/safari",
-            "title": {},
-            "author": "Bob",
-            "date": "2015-11-16T01:22:01.000Z",
+            "link": "https://trac.webkit.org/changeset/33022",
+            "title": { innerHTML: "commit message" },
+            "author": "[email protected]",
+            "date": new Date("2015-11-16T01:22:01.000Z"),
             "description": "description",
             "containsBranchLocation": true,
             "branchName": "trunk"

Added: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/test-fixture-trac-rss.xml (0 => 195658)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/test-fixture-trac-rss.xml	                        (rev 0)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/test-fixture-trac-rss.xml	2016-01-27 07:43:50 UTC (rev 195658)
@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+<!--
+Copyright (C) 2016 Apple, 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:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. 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.
+
+THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
+-->
+
+<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
+  <channel>
+    <title>WebKit</title>
+    <link>https://trac.webkit.org/timeline</link>
+    <description>Trac Timeline</description>
+    <language>en-US</language>
+    <generator>Trac 0.12.3</generator>
+    <image>
+      <title>WebKit</title>
+      <url>https://trac.webkit.org/chrome/site/favicon.png</url>
+      <link>https://trac.webkit.org/timeline</link>
+    </image>
+    <item>
+      <title>Changeset [33025]: Ita prorsus inquam Ad corpus diceres pertinere, sed ea, quae dixi</title>
+      
+        <author>[email protected]</author>
+
+      <pubDate>Tue, 26 Jan 2016 22:48:15 GMT</pubDate>
+      <link>https://trac.webkit.org/changeset/33025</link>
+      <guid isPermaLink="false">https://trac.webkit.org/changeset/33025/1453848495332569</guid>
+      <description>Description</description>
+      <category>changeset</category>
+    </item><item>
+      <title>Changeset [33024]: An eum discere ea mavis, quae cum plane perdidiceriti nihil sciat</title>
+      
+        <author>[email protected]</author>
+
+      <pubDate>Tue, 26 Jan 2016 22:22:25 GMT</pubDate>
+      <link>https://trac.webkit.org/changeset/33024</link>
+      <guid isPermaLink="false">https://trac.webkit.org/changeset/33024/1453846945244007</guid>
+      <description>Description</description>
+      <category>changeset</category>
+    </item><item>
+      <title>Changeset [33023]: Lorem ipsum dolor sit amet, consectetur adipiscing elit.</title>
+      
+        <author>[email protected]</author>
+
+      <pubDate>Tue, 26 Jan 2016 22:22:14 GMT</pubDate>
+      <link>https://trac.webkit.org/changeset/33023</link>
+      <guid isPermaLink="false">https://trac.webkit.org/changeset/33023/1453846934034550</guid>
+      <description>Description</description>
+      <category>changeset</category>
+    </item>
+   </channel>
+</rss>
\ No newline at end of file

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/tests.js (195657 => 195658)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/tests.js	2016-01-27 07:13:31 UTC (rev 195657)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/tests.js	2016-01-27 07:43:50 UTC (rev 195658)
@@ -23,6 +23,30 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+module("Trac", {
+    setup: function() {
+        this.trac = new MockTrac();
+    }
+});
+
+test("_loaded", function()
+{
+    var client = new XMLHttpRequest();
+    client.open('GET', 'test-fixture-trac-rss.xml', false);
+    client._onreadystatechange_ = function () {
+        if (client.readyState === client.DONE)
+            this.trac._loaded(client.responseXML);
+    }.bind(this);
+    client.send();
+    var commits = this.trac.recordedCommits;
+    strictEqual(commits.length, 8, "should have 8 commits");
+    for (var i = 1; i < commits.length; i++) {
+        var firstRevision = commits[i - 1].revisionNumber;
+        var secondRevision = commits[i].revisionNumber;
+        strictEqual(secondRevision - firstRevision, 1, "commits should be in order " + firstRevision + ", " + secondRevision);
+    }
+});
+
 module("BuildBotQueueView");
 
 var settings = new Settings;

Modified: trunk/Tools/ChangeLog (195657 => 195658)


--- trunk/Tools/ChangeLog	2016-01-27 07:13:31 UTC (rev 195657)
+++ trunk/Tools/ChangeLog	2016-01-27 07:43:50 UTC (rev 195658)
@@ -1,3 +1,22 @@
+2016-01-26  Jason Marcell  <[email protected]>
+
+        Sort incoming commits via date instead of revision number.
+        https://bugs.webkit.org/show_bug.cgi?id=153467
+
+        Reviewed by Alexey Proskuryakov.
+
+        Future Trac instances may use Git or other revision control systems where we cannnot rely on the revision number
+        for sorting revisions. Instead we use the commit date to sort revisions chronologically.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js:
+        (Trac.prototype._loaded): Sort via date instead of revision number.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/MockTrac.js:
+        (MockTrac): Fix up the mock data to look more like real-world data.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/test-fixture-trac-rss.xml: Added.
+        Fake RSS feed that adds three more commits.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/tests.js: Added unit tests to test
+        Trac._loaded().
+
 2016-01-26  I-Ting Liu  <[email protected]>
 
         Add a test for WebKit::stringMatchesWildcardString.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to