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

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

Issue 464963003: Move commit list out its own model. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | Tools/GardeningServer/model/ct-failure-group.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!--
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
4 found in the LICENSE file.
5 -->
6
7 <link rel="import" href="ct-commit-log.html">
8
9 <script>
10 function CTCommitList(group, commits) {
11 this.revisionLog = commits;
12 if (group.failures && group.failures.first()) {
13 this.firstFailing = group.failures.first().firstFailingRevisions;
14 this.lastPassing = group.failures.first().lastPassingRevisions;
15 }
16 }
17
18 CTCommitList.prototype.repositories = function() {
19 var ret = [];
20 if (!this.revisionLog || !this.lastPassing || !this.firstFailing)
ojan 2014/08/15 17:36:55 Is it actually possible not to have a revisionLog?
21 return ret;
22
23 var allRepositories = Object.keys(this.revisionLog.commits).sort();
24 for (var i = 0; i < allRepositories.length; i++) {
25 var repository = allRepositories[i];
26
27 var commits = this._commits(repository);
28 if (!commits.length)
29 continue;
30
31 ret.push({
32 name: repository,
33 range: this._range(commits),
34 commits: commits,
35 expanded: false
36 });
37 }
38 return ret;
39 };
40
41 CTCommitList.prototype._commits = function(repository) {
42 var commits = [];
43
44 if (!this.firstFailing || !this.lastPassing)
45 return [];
46
47 var firstFailing = Number(this.firstFailing[repository]);
48 var lastPassing = Number(this.lastPassing[repository]);
49 if (firstFailing == lastPassing)
50 return commits;
51
52 if (lastPassing > firstFailing) {
53 console.warn('Revision range is backwards, which is invalid:', lastPassing, firstFailing);
54 return commits;
55 }
56
57 return this.revisionLog.range(repository, lastPassing + 1, firstFailing);
58 };
59
60 CTCommitList.prototype._range = function(commits) {
61 return commits.first().revision + " : " + commits.last().revision;
62 };
63
64 </script>
OLDNEW
« no previous file with comments | « no previous file | Tools/GardeningServer/model/ct-failure-group.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698