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.
7 <link rel="import" href="ct-commit-log.html">
8 <link rel="import" href="ct-repository-commit-list.html">
11 function CTCommitList(commitLog, revisions) {
12 this._initRevisions(revisions);
13 this.update(commitLog);
16 CTCommitList.prototype.update = function(commitLog) {
17 this.repositories = [];
21 var allRepositories = commitLog._repositories.names;
22 for (var i = 0; i < allRepositories.length; i++) {
23 var repository = allRepositories[i];
24 if (!this.revisions[repository])
27 var commits = commitLog.range(repository, this.revisions[repository]);
31 this.repositories.push(new CTRepositoryCommitList(repository, commits));
35 CTCommitList.prototype._initRevisions = function(repoRevisions) {
37 repoRevisions.forEach(function(repoRevision) {
38 var split = repoRevision.split(':');
40 var revision = parseInt(split[1], 10);
41 if (revision && repo) {
42 if (!this.revisions[repo]) {
43 this.revisions[repo] = [revision];
45 this.revisions[repo].push(revision);