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

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
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 this.firstFailing = group.failures.first().firstFailingRevisions;
13 this.lastPassing = group.failures.first().lastPassingRevisions;
14 }
15
16 CTCommitList.prototype.repositories = function() {
17 var ret = [];
18 if (!this.revisionLog || !this.lastPassing || !this.firstFailing)
19 return ret;
20
21 var allRepositories = Object.keys(this.revisionLog.commits).sort();
22 for (var i = 0; i < allRepositories.length; i++) {
23 var repository = allRepositories[i];
24
25 var commits = this._commits(repository);
26 if (commits.length == 0)
ojan 2014/08/12 21:08:36 Nit: normally we just do "if (!commits.length)"
dsinclair 2014/08/15 14:05:04 Done.
27 continue;
28
29 ret.push({
30 name: repository,
31 range: this._range(commits),
32 commits: commits
33 });
34 }
35 return ret;
36 };
37
38 CTCommitList.prototype._commits = function(repository) {
39 var commits = [];
40
41 var firstFailing = Number(this.firstFailing[repository]);
42 var lastPassing = Number(this.lastPassing[repository]);
43 if (firstFailing == lastPassing)
44 return commits;
45
46 if (lastPassing > firstFailing) {
47 console.warn('Revision range is backwards, which is invalid:', lastPassing, firstFailing);
48 return commits;
49 }
50
51 return this.revisionLog.range(repository, lastPassing + 1, firstFailing);
52 };
53
54 /* The existence of commits is a pre-condition to this method. */
ojan 2014/08/12 21:08:36 Nit: that's pretty clear from a glance at the code
dsinclair 2014/08/15 14:05:04 Done.
55 CTCommitList.prototype._range = function(commits) {
56 return commits.first().revision + " : " + commits.last().revision;
57 };
58
59 </script>
OLDNEW
« no previous file with comments | « no previous file | Tools/GardeningServer/ui/ct-commit-list.html » ('j') | Tools/GardeningServer/ui/ct-failure-stream.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698