Title: [187871] trunk/Tools
Revision
187871
Author
[email protected]
Date
2015-08-04 11:48:32 -0700 (Tue, 04 Aug 2015)

Log Message

Refactor to convert openSourceRevision and internalRevision properties on BuildbotIteration into a more generic collection of revisions.
https://bugs.webkit.org/show_bug.cgi?id=147280

Patch by Jason Marcell <[email protected]> on 2015-08-04
Reviewed by Daniel Bates.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js:
(BuildbotIteration): Removed opensourceRevision, internalRevision. Added revision.
Refactored _parseData to handle repositories more generically.
(parseRevisionProperty): Moved a comment up to parseRevisionProperty where it seems more relevant.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js:
(BuildbotQueue.prototype.compareIterations): Using "revision" property instead of
"opensourceRevision" and "internalRevision".
(BuildbotQueue.prototype.compareIterationsByRevisions): Ditto.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js:
(BuildbotQueueView.prototype._appendPendingRevisionCount): Ditto.
(BuildbotQueueView.prototype._presentPopoverForPendingCommits): Ditto.
(BuildbotQueueView.prototype._revisionContentWithPopoverForIteration): Changing "internal" boolean
parameter to more generic "repository" string parameter. Added "trac" parameter in order to
specify the trac instance to use. Using "revision" property instead of "opensourceRevision"
and "internalRevision".
(BuildbotQueueView.prototype.revisionContentForIteration): Passing the repository name and trac
instance to _revisionContentWithPopoverForIteration(). Using "revision" property instead of
"opensourceRevision" and "internalRevision".
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Dashboard.js: Adding
constants for internal and opensource repositories.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/MetricsAnalyzer.js:
(Analyzer.prototype._findIndexOfLargestIterationAtOrBeforeStart): Using "revision" property
instead of "opensourceRevision" and "internalRevision".
(Analyzer.prototype._countPercentageOfGreen): Ditto.
(Analyzer.prototype.webkitTrac.recordedCommits.forEach): Ditto.
(Analyzer.prototype._countTimes): Ditto.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/WebKitBuildbot.js:
(WebKitBuildbot.prototype.layoutTestResultsDirectoryURLForIteration): Ditto.

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js (187870 => 187871)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js	2015-08-04 18:43:35 UTC (rev 187870)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js	2015-08-04 18:48:32 UTC (rev 187871)
@@ -43,8 +43,7 @@
     this.isLoading = false;
     this._productive = false;
 
-    this.openSourceRevision = null;
-    this.internalRevision = null;
+    this.revision = {};
 
     this.layoutTestResults = null; // Layout test results can be needed even if all tests passed, e.g. for the leaks bot.
 
@@ -102,6 +101,12 @@
     if (!property)
         return null;
     var value = property[1];
+
+    // The property got_revision may have the following forms:
+    //
+    // ["got_revision",{"Internal":"1357","WebKitOpenSource":"2468"},"Source"]
+    // OR
+    // ["got_revision","2468","Source"]
     if (isMultiCodebaseGotRevisionProperty(property))
         value = (key in value) ? value[key] : value[fallbackKey];
     return parseInt(value);
@@ -188,24 +193,25 @@
         console.assert(!this.id || this.id === data.number);
         this.id = data.number;
 
-        // The property got_revision may have the following forms:
-        //
-        // ["got_revision",{"Internal":"1357","WebKitOpenSource":"2468"},"Source"]
-        // OR
-        // ["got_revision","2468","Source"]
-        //
-        // When extracting the OpenSource revision from property got_revision we don't need to check whether the
-        // value of got_revision is a dictionary (represents multiple codebases) or a string literal because we
-        // assume that got_revision contains the OpenSource revision. However, it may not have the Internal
-        // revision. Therefore, we only look at got_revision to extract the Internal revision when it's
-        // a dictionary.
+        var revisionProperty = data.properties.findFirst(function(property) {
+            return property[0] === "got_revision";
+        });
+        for (repository in this.queue.branch) {
+            var key;
+            var fallbackKey;
+            if (repository === Dashboard.Repository.OpenSource.name) {
+                key = "WebKit";
+                fallbackKey = "opensource";
+            } else if (repository === Dashboard.Repository.Internal.name) {
+                key = "Internal";
+                fallbackKey = "internal";
+            } else {
+                key = repository;
+                fallbackKey = null;
+            }
+            this.revision[repository] = parseRevisionProperty(revisionProperty, key, fallbackKey);
+        }
 
-        var openSourceRevisionProperty = data.properties.findFirst(function(property) { return property[0] === "got_revision"; });
-        this.openSourceRevision = parseRevisionProperty(openSourceRevisionProperty, "WebKit", "opensource");
-
-        var internalRevisionProperty = data.properties.findFirst(function(property) { return isMultiCodebaseGotRevisionProperty(property); });
-        this.internalRevision = parseRevisionProperty(internalRevisionProperty, "Internal", "internal");
-
         function sourceStampChanges(sourceStamp) {
             var result = [];
             var changes = sourceStamp.changes;

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js (187870 => 187871)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js	2015-08-04 18:43:35 UTC (rev 187870)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js	2015-08-04 18:48:32 UTC (rev 187871)
@@ -268,11 +268,11 @@
 
     compareIterations: function(a, b)
     {
-        var result = b.openSourceRevision - a.openSourceRevision;
+        var result = b.revision[Dashboard.Repository.OpenSource.name] - a.revision[Dashboard.Repository.OpenSource.name];
         if (result)
             return result;
 
-        result = b.internalRevision - a.internalRevision;
+        result = b.revision[Dashboard.Repository.Internal.name] - a.revision[Dashboard.Repository.Internal.name];
         if (result)
             return result;
 
@@ -286,11 +286,11 @@
 
     compareIterationsByRevisions: function(a, b)
     {
-        var result = b.openSourceRevision - a.openSourceRevision;
+        var result = b.revision[Dashboard.Repository.OpenSource.name] - a.revision[Dashboard.Repository.OpenSource.name];
         if (result)
             return result;
 
-        result = b.internalRevision - a.internalRevision;
+        result = b.revision[Dashboard.Repository.Internal.name] - a.revision[Dashboard.Repository.Internal.name];
         if (result)
             return result;
 

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js (187870 => 187871)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js	2015-08-04 18:43:35 UTC (rev 187870)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js	2015-08-04 18:48:32 UTC (rev 187871)
@@ -77,23 +77,23 @@
             return;
 
         var latestRecordedOpenSourceRevisionNumber = webkitTrac.latestRecordedRevisionNumber;
-        if (!latestRecordedOpenSourceRevisionNumber || webkitTrac.oldestRecordedRevisionNumber > latestProductiveIteration.openSourceRevision) {
+        if (!latestRecordedOpenSourceRevisionNumber || webkitTrac.oldestRecordedRevisionNumber > latestProductiveIteration.revision[Dashboard.Repository.OpenSource.name]) {
             webkitTrac.loadMoreHistoricalData();
             return;
         }
 
         // FIXME: To be 100% correct, we should also filter out changes that are ignored by
         // the queue, see _should_file_trigger_build in wkbuild.py.
-        var totalRevisionsBehind = webkitTrac.commitsOnBranch(queue.branch.openSource, function(commit) { return commit.revisionNumber > latestProductiveIteration.openSourceRevision; }).length;
+        var totalRevisionsBehind = webkitTrac.commitsOnBranch(queue.branch.openSource, function(commit) { return commit.revisionNumber > latestProductiveIteration.revision[Dashboard.Repository.OpenSource.name]; }).length;
 
-        if (latestProductiveIteration.internalRevision) {
+        if (latestProductiveIteration.revision[Dashboard.Repository.Internal.name]) {
             var latestRecordedInternalRevisionNumber = internalTrac.latestRecordedRevisionNumber;
-            if (!latestRecordedInternalRevisionNumber || internalTrac.oldestRecordedRevisionNumber > latestProductiveIteration.internalRevision) {
+            if (!latestRecordedInternalRevisionNumber || internalTrac.oldestRecordedRevisionNumber > latestProductiveIteration.revision[Dashboard.Repository.Internal.name]) {
                 internalTrac.loadMoreHistoricalData();
                 return;
             }
 
-            totalRevisionsBehind += internalTrac.commitsOnBranch(queue.branch.internal, function(commit) { return commit.revisionNumber > latestProductiveIteration.internalRevision; }).length;
+            totalRevisionsBehind += internalTrac.commitsOnBranch(queue.branch.internal, function(commit) { return commit.revisionNumber > latestProductiveIteration.revision[Dashboard.Repository.Internal.name]; }).length;
         }
 
         if (!totalRevisionsBehind)
@@ -153,13 +153,13 @@
         var content = document.createElement("div");
         content.className = "commit-history-popover";
 
-        var linesForOpenSource = this._popoverLinesForCommitRange(webkitTrac, queue.branch.openSource, latestProductiveIteration.openSourceRevision + 1, webkitTrac.latestRecordedRevisionNumber);
+        var linesForOpenSource = this._popoverLinesForCommitRange(webkitTrac, queue.branch.openSource, latestProductiveIteration.revision[Dashboard.Repository.OpenSource.name] + 1, webkitTrac.latestRecordedRevisionNumber);
         for (var i = 0; i != linesForOpenSource.length; ++i)
             content.appendChild(linesForOpenSource[i]);
 
         var linesForInternal = [];
-        if (latestProductiveIteration.internalRevision && internalTrac.latestRecordedRevisionNumber)
-            var linesForInternal = this._popoverLinesForCommitRange(internalTrac, queue.branch.internal, latestProductiveIteration.internalRevision + 1, internalTrac.latestRecordedRevisionNumber);
+        if (latestProductiveIteration.revision[Dashboard.Repository.Internal.name] && internalTrac.latestRecordedRevisionNumber)
+            var linesForInternal = this._popoverLinesForCommitRange(internalTrac, queue.branch.internal, latestProductiveIteration.revision[Dashboard.Repository.Internal.name] + 1, internalTrac.latestRecordedRevisionNumber);
 
         if (linesForOpenSource.length && linesForInternal.length)
             this._addDividerToPopover(content);
@@ -204,18 +204,18 @@
         return true;
     },
 
-    _revisionContentWithPopoverForIteration: function(iteration, previousIteration, internal)
+    _revisionContentWithPopoverForIteration: function(iteration, previousIteration, repository, trac)
     {
         var content = document.createElement("span");
-        content.textContent = "r" + (internal ? iteration.internalRevision : iteration.openSourceRevision);
+        content.textContent = "r" + iteration.revision[repository];
         content.classList.add("revision-number");
 
         if (previousIteration) {
             var context = {
-                trac: internal ? internalTrac : webkitTrac,
-                branch: internal ? iteration.queue.branch.internal : iteration.queue.branch.openSource,
-                firstRevision: (internal ? previousIteration.internalRevision : previousIteration.openSourceRevision) + 1,
-                lastRevision: internal ? iteration.internalRevision : iteration.openSourceRevision
+                trac: trac,
+                branch: iteration.queue.branch[repository],
+                firstRevision: previousIteration.revision[repository] + 1,
+                lastRevision: iteration.revision[repository]
             };
             if (context.firstRevision <= context.lastRevision)
                 new PopoverTracker(content, this._presentPopoverForRevisionRange.bind(this), context);
@@ -260,14 +260,14 @@
 
     revisionContentForIteration: function(iteration, previousDisplayedIteration)
     {
-        console.assert(iteration.openSourceRevision);
+        console.assert(iteration.revision[Dashboard.Repository.OpenSource.name]);
 
-        var openSourceContent = this._revisionContentWithPopoverForIteration(iteration, previousDisplayedIteration);
+        var openSourceContent = this._revisionContentWithPopoverForIteration(iteration, previousDisplayedIteration, Dashboard.Repository.OpenSource.name, webkitTrac);
 
-        if (!iteration.internalRevision)
+        if (!iteration.revision[Dashboard.Repository.Internal.name])
             return openSourceContent;
 
-        var internalContent = this._revisionContentWithPopoverForIteration(iteration, previousDisplayedIteration, true);
+        var internalContent = this._revisionContentWithPopoverForIteration(iteration, previousDisplayedIteration, Dashboard.Repository.Internal.name, internalTrac);
 
         var fragment = document.createDocumentFragment();
         fragment.appendChild(openSourceContent);

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Dashboard.js (187870 => 187871)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Dashboard.js	2015-08-04 18:43:35 UTC (rev 187870)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Dashboard.js	2015-08-04 18:48:32 UTC (rev 187871)
@@ -35,5 +35,9 @@
         LinuxGTK: { name : "linux-gtk", readableName: "Linux GTK", order: 90 },
         LinuxEFL: { name: "linux-efl", readableName: "Linux EFL", order : 100 }
     },
-    Branch: {}
+    Branch: {},
+    Repository: {
+        OpenSource: { name: "openSource", order: 0 },
+        Internal: { name: "internal", order: 1 },
+    }
 };

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/MetricsAnalyzer.js (187870 => 187871)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/MetricsAnalyzer.js	2015-08-04 18:43:35 UTC (rev 187870)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/MetricsAnalyzer.js	2015-08-04 18:48:32 UTC (rev 187871)
@@ -124,7 +124,7 @@
         if (i < iterations.length)
             result = i++;
         while (i < iterations.length) {
-            if (iterations[i].openSourceRevision > iterations[result].openSourceRevision)
+            if (iterations[i].revision[Dashboard.Repository.OpenSource.name] > iterations[result].revision[Dashboard.Repository.OpenSource.name])
                 result = i;
             ++i;
         }
@@ -213,7 +213,7 @@
                 this._updateStretchOfRedCounters(topIterationByQueue, currentTime, stretchOfRedCounters);
                 continue;
             }
-            if (iterations[i].openSourceRevision <= topIterationByQueue[iterations[i].queue.id].openSourceRevision)
+            if (iterations[i].revision[Dashboard.Repository.OpenSource.name] <= topIterationByQueue[iterations[i].queue.id].revision[Dashboard.Repository.OpenSource.name])
                 continue;
 
             var dashboardWasAllGreen = this._dashboardIsAllGreen(topIterationByQueue);
@@ -275,7 +275,7 @@
                     return;
                 for (var i = 0; i < relevantIterationsByQueue[queue.id].length; ++i) {
                     var iteration = relevantIterationsByQueue[queue.id][i];
-                    if (iteration.openSourceRevision >= revision.revisionNumber) {
+                    if (iteration.revision[Dashboard.Repository.OpenSource.name] >= revision.revisionNumber) {
                         endTime = Math.max(endTime, iteration.endTime);
                         ownTime = Math.max(ownTime, iteration.endTime - iteration.startTime);
                         break;

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/WebKitBuildbot.js (187870 => 187871)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/WebKitBuildbot.js	2015-08-04 18:43:35 UTC (rev 187870)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/WebKitBuildbot.js	2015-08-04 18:48:32 UTC (rev 187871)
@@ -82,6 +82,6 @@
 
     layoutTestResultsDirectoryURLForIteration: function(iteration)
     {
-        return this.baseURL + "results/" + encodeURIComponent(iteration.queue.id) + "/" + encodeURIComponent("r" + iteration.openSourceRevision + " (" + iteration.id + ")");
+        return this.baseURL + "results/" + encodeURIComponent(iteration.queue.id) + "/" + encodeURIComponent("r" + iteration.revision[Dashboard.Repository.OpenSource.name] + " (" + iteration.id + ")");
     }
 };

Modified: trunk/Tools/ChangeLog (187870 => 187871)


--- trunk/Tools/ChangeLog	2015-08-04 18:43:35 UTC (rev 187870)
+++ trunk/Tools/ChangeLog	2015-08-04 18:48:32 UTC (rev 187871)
@@ -1,3 +1,39 @@
+2015-08-04  Jason Marcell  <[email protected]>
+
+        Refactor to convert openSourceRevision and internalRevision properties on BuildbotIteration into a more generic collection of revisions.
+        https://bugs.webkit.org/show_bug.cgi?id=147280
+
+        Reviewed by Daniel Bates.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js:
+        (BuildbotIteration): Removed opensourceRevision, internalRevision. Added revision.
+        Refactored _parseData to handle repositories more generically.
+        (parseRevisionProperty): Moved a comment up to parseRevisionProperty where it seems more relevant.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js:
+        (BuildbotQueue.prototype.compareIterations): Using "revision" property instead of
+        "opensourceRevision" and "internalRevision".
+        (BuildbotQueue.prototype.compareIterationsByRevisions): Ditto.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js:
+        (BuildbotQueueView.prototype._appendPendingRevisionCount): Ditto.
+        (BuildbotQueueView.prototype._presentPopoverForPendingCommits): Ditto.
+        (BuildbotQueueView.prototype._revisionContentWithPopoverForIteration): Changing "internal" boolean
+        parameter to more generic "repository" string parameter. Added "trac" parameter in order to
+        specify the trac instance to use. Using "revision" property instead of "opensourceRevision"
+        and "internalRevision".
+        (BuildbotQueueView.prototype.revisionContentForIteration): Passing the repository name and trac
+        instance to _revisionContentWithPopoverForIteration(). Using "revision" property instead of
+        "opensourceRevision" and "internalRevision".
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Dashboard.js: Adding
+        constants for internal and opensource repositories.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/MetricsAnalyzer.js:
+        (Analyzer.prototype._findIndexOfLargestIterationAtOrBeforeStart): Using "revision" property
+        instead of "opensourceRevision" and "internalRevision".
+        (Analyzer.prototype._countPercentageOfGreen): Ditto.
+        (Analyzer.prototype.webkitTrac.recordedCommits.forEach): Ditto.
+        (Analyzer.prototype._countTimes): Ditto.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/WebKitBuildbot.js:
+        (WebKitBuildbot.prototype.layoutTestResultsDirectoryURLForIteration): Ditto.
+
 2015-08-04  Mark Lam  <[email protected]>
 
         Removed a local debugging line I accidentally left in from a previous commit.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to