Changeset 172892 in webkit
- Timestamp:
- Aug 23, 2014 6:35:16 PM (10 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js
r172747 r172892 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 45 45 46 46 Trac.Event = { 47 CommitsUpdated: "commits-updated" 47 CommitsUpdated: "commits-updated", 48 Loaded: "loaded" 48 49 }; 49 50 … … 79 80 var toDay = new Date(toDate.getFullYear(), toDate.getMonth(), toDate.getDate()); 80 81 81 return this.baseURL + "timeline?changeset=on&format=rss&max= -1" +82 return this.baseURL + "timeline?changeset=on&format=rss&max=0" + 82 83 "&from=" + (toDay.getMonth() + 1) + "%2F" + toDay.getDate() + "%2F" + (toDay.getFullYear() % 100) + 83 84 "&daysback=" + ((toDay - fromDay) / 1000 / 60 / 60 / 24); … … 127 128 _loaded: function(dataDocument) 128 129 { 129 var earliestKnownRevision = 0; 130 var latestKnownRevision = 0; 131 if (this.recordedCommits.length) { 132 earliestKnownRevision = this.recordedCommits[0].revisionNumber; 133 latestKnownRevision = this.recordedCommits[this.recordedCommits.length - 1].revisionNumber; 134 } 130 var recordedRevisionNumbers = this.recordedCommits.reduce(function(previousResult, commit) { 131 previousResult[commit.revisionNumber] = commit; 132 return previousResult; 133 }, {}); 135 134 136 135 var knownCommitsWereUpdated = false; 137 136 var newCommits = []; 138 var newCommitsBeforeEarliestKnownRevision = [];139 137 140 138 var commitInfoElements = dataDocument.evaluate("/rss/channel/item", dataDocument, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE); 141 var commitInfoElement = undefined; 142 var indexInRecordedCommits = undefined; 139 var commitInfoElement; 143 140 while (commitInfoElement = commitInfoElements.iterateNext()) { 144 141 var commit = this._convertCommitInfoElementToObject(dataDocument, commitInfoElement); 145 if (commit.revisionNumber > latestKnownRevision) { 146 console.assert(typeof indexInRecordedCommits === "undefined"); 147 newCommits.push(commit); 148 } else if (commit.revisionNumber < earliestKnownRevision) { 149 console.assert(typeof indexInRecordedCommits === "undefined" || indexInRecordedCommits === -1); 150 newCommitsBeforeEarliestKnownRevision.push(commit); 151 } else { 152 if (typeof indexInRecordedCommits === "undefined") { 153 // We could have started anywhere in the recorded commits array, let's find where. 154 // With periodic updates, this will be the latest recorded commit, so starting from the end. 155 for (var i = this.recordedCommits.length - 1; i >= 0; --i) { 156 if (this.recordedCommits[i].revisionNumber === commit.revisionNumber) { 157 indexInRecordedCommits = i; 158 break; 159 } 160 } 161 } 162 163 console.assert(indexInRecordedCommits >= 0); 164 console.assert(this.recordedCommits[indexInRecordedCommits].revisionNumber === commit.revisionNumber); 165 142 if (commit.revisionNumber in recordedRevisionNumbers) { 166 143 // Author could have changed, as commit queue replaces it after the fact. 167 if (this.recordedCommits[indexInRecordedCommits].author !== commit.author) { 168 this.recordedCommits[indexInRecordedCommits].author = commit.author; 144 console.assert(recordedRevisionNumbers[commit.revisionNumber].revisionNumber === commit.revisionNumber); 145 if (recordedRevisionNumbers[commit.revisionNumber].author != commit.author) { 146 recordedRevisionNumbers[commit.revisionNumber].author = commit.author; 169 147 knownCommitWasUpdated = true; 170 148 } 171 --indexInRecordedCommits;172 }149 } else 150 newCommits.push(commit); 173 151 } 174 152 175 if (newCommits.length || newCommitsBeforeEarliestKnownRevision.length)176 this.recordedCommits = newCommits BeforeEarliestKnownRevision.reverse().concat(this.recordedCommits, newCommits.reverse());153 if (newCommits.length) 154 this.recordedCommits = newCommits.concat(this.recordedCommits).sort(function(a, b) { return a.revisionNumber - b.revisionNumber; }); 177 155 178 if (newCommits.length || newCommitsBeforeEarliestKnownRevision.length ||knownCommitsWereUpdated)156 if (newCommits.length || knownCommitsWereUpdated) 179 157 this.dispatchEventToListeners(Trac.Event.CommitsUpdated, null); 158 }, 159 160 load: function(fromDate, toDate) 161 { 162 loadXML(this._xmlTimelineURL(fromDate, toDate), function(dataDocument) { 163 this._loaded(dataDocument); 164 this.dispatchEventToListeners(Trac.Event.Loaded, [fromDate, toDate]); 165 }.bind(this), this._needsAuthentication ? { withCredentials: true } : {}); 180 166 }, 181 167 -
trunk/Tools/ChangeLog
r172891 r172892 1 2014-08-23 Alexey Proskuryakov <ap@apple.com> 2 3 build.webkit.org/dashboard: Further improve Trac loading 4 https://bugs.webkit.org/show_bug.cgi?id=136174 5 6 Reviewed by Timothy Hatcher. 7 8 * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js: 9 (Trac.prototype._xmlTimelineURL): Passing -1 as "max" resulted in an off by one 10 error, the oldest commit within the range wasn't returned. The correct argument for 11 "no limit" is 0. 12 (Trac.prototype.load): Added a function to load a specific time range. 13 (Trac.prototype._loaded): Updated to support loading revisions that are arbitrarily 14 positioned with regards to ones that were already known. 15 1 16 2014-08-23 Alexey Proskuryakov <ap@apple.com> 2 17
Note: See TracChangeset
for help on using the changeset viewer.