Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: Tools/GardeningServer/model/ct-commit-log.html

Issue 413073004: Show non-Blink ranges in sheriff-o-matic. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add missing files Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <!-- 1 <!--
2 Copyright 2014 The Chromium Authors. All rights reserved. 2 Copyright 2014 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be 3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file. 4 found in the LICENSE file.
5 --> 5 -->
6 6
7 <link rel='import' href='ct-commit.html'> 7 <link rel='import' href='ct-commit.html'>
8 8
9 <link rel='import' href='ct-repositories.html'>
10
9 <script> 11 <script>
10 function CTCommitLog() { 12 function CTCommitLog() {
11 // FIXME: This should be a map of repo-name to revision log using the same
12 // repo names that auto-sheriff.appspot's json uses.
13
14 // FIXME: Use better feeds.
15 // https://chromium.googlesource.com/chromium/blink/+log/master?format=json
16 // https://chromium.googlesource.com/chromium/chromium/+log/master?format=json
17 // https://code.google.com/feeds/p/skia/svnchanges/basic
18 // https://code.google.com/feeds/p/v8/svnchanges/basic
19 // https://code.google.com/feeds/p/nativeclient/svnchanges/basic
20 this.commits = {}; 13 this.commits = {};
14 this.firstRevision = {};
15 this._repositories = new CTRepositories();
21 } 16 }
22 17
23 CTCommitLog.prototype.update = function() { 18 CTCommitLog.prototype.update = function() {
24 // FIXME: Turn net.js into net.html and import it at the top of this file. 19 var requests = [];
25 return net.xml('http://blink.lc/blink/atom').then(this._processXml.bind(this)) ; 20 Object.keys(this._repositories.repositories, (function(name, repository) {
abarth-chromium 2014/07/29 16:22:26 repositories, repositories, repositories, reposito
ojan 2014/07/30 04:14:33 Yup. Felt silly writing this code, but didn't have
21 var responseHandler = this._handleResponse.bind(this, repository.repositoryU rl, repository.name);
22 // FIXME: Turn net.js into net.html and import it at the top of this file.
23 requests.push(net.ajax({url: repository.dataUrl}).then(responseHandler));
24 }.bind(this)));
25 return Promise.all(requests);
26 } 26 }
27 27
28 CTCommitLog.prototype._processXml = function(xml) { 28 CTCommitLog.prototype._handleResponse = function(repositoryUrl, repository, json ) {
29 Array.prototype.forEach.call(xml.getElementsByTagName('entry'), function(logen try) { 29 if (!this.commits[repository])
30 var author = logentry.getElementsByTagName('author')[0].textContent.trim(); 30 this.commits[repository] = {};
31 var message = logentry.getElementsByTagName('content')[0].textContent.trim() ; 31
32 // FIXME: Handle base urls for different repos. 32 // FIXME: Fix googlesource to not do this outdated JSON XSS mitigation.
33 var commit = new CTCommit(author, message, 'http://src.chromium.org/viewvc/b link'); 33 json = json.substring(')]}\n'.length);
abarth-chromium 2014/07/29 16:22:26 Can we do a feature detect so that this code doesn
ojan 2014/07/30 04:14:33 Good idea. Done.
34 this.commits[commit.revision] = commit; 34 JSON.parse(json).log.forEach(function(entry) {
35 var commit = CTCommit.create(entry.author.name, entry.message, repositoryUrl , repository);
36 this.commits[repository][commit.revision] = commit;
35 }.bind(this)); 37 }.bind(this));
38
39 this.firstRevision[repository] = Object.keys(this.commits[repository]).sort()[ 0];
40 }
41
42 CTCommitLog.prototype.range = function(repository, first, last) {
43 var commits = [];
44 for (var revision = first; revision <= last; revision++) {
45 // Until we've seen a commit we have data for, fill in dummy data
46 // so that we show something. Assume that we have the correct data
47 // for all the commits after the first one we have data for.
48 if (revision >= this.firstRevision[repository]) {
49 var commit = this.commits[repository][revision];
50 if (commit)
51 commits.push(commit);
52 } else {
53 var url = this._repositories.repositories[repository].repositoryUrl;
54 commits.push(CTCommit.createIncomplete(url, revision, repository));
55 }
56 }
57 return commits;
36 } 58 }
37 </script> 59 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698