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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: Tools/GardeningServer/model/ct-commit-list.html
diff --git a/Tools/GardeningServer/model/ct-commit-list.html b/Tools/GardeningServer/model/ct-commit-list.html
new file mode 100644
index 0000000000000000000000000000000000000000..4e14fea4d4e98776768ea9aad6e2536188f594be
--- /dev/null
+++ b/Tools/GardeningServer/model/ct-commit-list.html
@@ -0,0 +1,59 @@
+<!--
+Copyright 2014 The Chromium Authors. All rights reserved.
+Use of this source code is governed by a BSD-style license that can be
+found in the LICENSE file.
+-->
+
+<link rel="import" href="ct-commit-log.html">
+
+<script>
+function CTCommitList(group, commits) {
+ this.revisionLog = commits;
+ this.firstFailing = group.failures.first().firstFailingRevisions;
+ this.lastPassing = group.failures.first().lastPassingRevisions;
+}
+
+CTCommitList.prototype.repositories = function() {
+ var ret = [];
+ if (!this.revisionLog || !this.lastPassing || !this.firstFailing)
+ return ret;
+
+ var allRepositories = Object.keys(this.revisionLog.commits).sort();
+ for (var i = 0; i < allRepositories.length; i++) {
+ var repository = allRepositories[i];
+
+ var commits = this._commits(repository);
+ 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.
+ continue;
+
+ ret.push({
+ name: repository,
+ range: this._range(commits),
+ commits: commits
+ });
+ }
+ return ret;
+};
+
+CTCommitList.prototype._commits = function(repository) {
+ var commits = [];
+
+ var firstFailing = Number(this.firstFailing[repository]);
+ var lastPassing = Number(this.lastPassing[repository]);
+ if (firstFailing == lastPassing)
+ return commits;
+
+ if (lastPassing > firstFailing) {
+ console.warn('Revision range is backwards, which is invalid:', lastPassing, firstFailing);
+ return commits;
+ }
+
+ return this.revisionLog.range(repository, lastPassing + 1, firstFailing);
+};
+
+/* 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.
+CTCommitList.prototype._range = function(commits) {
+ return commits.first().revision + " : " + commits.last().revision;
+};
+
+</script>
« 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