OLD | NEW |
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-log.html"> | 7 <link rel="import" href="ct-commit-log.html"> |
8 | 8 |
9 <script> | 9 <script> |
10 function CTCommitList(group, commits) { | 10 function CTCommitList(group, commits) { |
11 this.revisionLog = commits; | 11 this.commitLog = commits; |
12 if (group.failures && group.failures.first()) { | 12 if (group.failures && group.failures.first()) { |
13 this.firstFailing = group.failures.first().firstFailingRevisions; | 13 this.firstFailing = group.failures.first().firstFailingRevisions; |
14 this.lastPassing = group.failures.first().lastPassingRevisions; | 14 this.lastPassing = group.failures.first().lastPassingRevisions; |
15 } | 15 } |
| 16 this._updateRepositories(); |
16 } | 17 } |
17 | 18 |
18 CTCommitList.prototype.repositories = function() { | 19 CTCommitList.prototype._updateRepositories = function() { |
19 var ret = []; | 20 this.repositories = []; |
20 if (!this.revisionLog || !this.lastPassing || !this.firstFailing) | 21 if (!this.commitLog || !this.lastPassing || !this.firstFailing) |
21 return ret; | 22 return; |
22 | 23 |
23 var allRepositories = Object.keys(this.revisionLog.commits).sort(); | 24 var allRepositories = this.commitLog._repositories.names; |
24 for (var i = 0; i < allRepositories.length; i++) { | 25 for (var i = 0; i < allRepositories.length; i++) { |
25 var repository = allRepositories[i]; | 26 var repository = allRepositories[i]; |
26 | 27 |
27 var commits = this._commits(repository); | 28 var commits = this._commits(repository); |
28 if (!commits.length) | 29 if (!commits.length) |
29 continue; | 30 continue; |
30 | 31 |
31 ret.push({ | 32 this.repositories.push({ |
32 name: repository, | 33 name: repository, |
33 range: this._range(commits), | 34 range: this._range(commits), |
34 commits: commits, | 35 commits: commits, |
35 expanded: false | 36 expanded: false |
36 }); | 37 }); |
37 } | 38 } |
38 return ret; | |
39 }; | 39 }; |
40 | 40 |
41 CTCommitList.prototype._commits = function(repository) { | 41 CTCommitList.prototype._commits = function(repository) { |
42 var commits = []; | 42 var commits = []; |
43 | 43 |
44 if (!this.firstFailing || !this.lastPassing) | 44 if (!this.firstFailing || !this.lastPassing) |
45 return []; | 45 return []; |
46 | 46 |
47 var firstFailing = Number(this.firstFailing[repository]); | 47 var firstFailing = Number(this.firstFailing[repository]); |
48 var lastPassing = Number(this.lastPassing[repository]); | 48 var lastPassing = Number(this.lastPassing[repository]); |
49 if (firstFailing == lastPassing) | 49 if (firstFailing == lastPassing) |
50 return commits; | 50 return commits; |
51 | 51 |
52 if (lastPassing > firstFailing) { | 52 if (lastPassing > firstFailing) { |
53 console.warn('Revision range is backwards, which is invalid:', lastPassing,
firstFailing); | 53 console.warn('Revision range is backwards, which is invalid:', lastPassing,
firstFailing); |
54 return commits; | 54 return commits; |
55 } | 55 } |
56 | 56 |
57 return this.revisionLog.range(repository, lastPassing + 1, firstFailing); | 57 return this.commitLog.range(repository, lastPassing + 1, firstFailing); |
58 }; | 58 }; |
59 | 59 |
60 CTCommitList.prototype._range = function(commits) { | 60 CTCommitList.prototype._range = function(commits) { |
61 return commits.first().revision + " : " + commits.last().revision; | 61 return commits.first().revision + " : " + commits.last().revision; |
62 }; | 62 }; |
63 | 63 |
64 </script> | 64 </script> |
OLD | NEW |