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

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

Issue 526633002: Apply object updates from the network without blowing away object identity or UI attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Initial Created 6 years, 3 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
OLDNEW
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 <link rel="import" href="ct-repository-commit-list.html">
8 9
9 <script> 10 <script>
10 function CTCommitList(commitLog, revisions) { 11 function CTCommitList(commitLog, revisions) {
11 this._initRevisions(revisions); 12 this._initRevisions(revisions);
12 this.update(commitLog); 13 this.update(commitLog);
13 } 14 }
14 15
15 CTCommitList.prototype.update = function(commitLog) { 16 CTCommitList.prototype.update = function(commitLog) {
16 this.repositories = []; 17 this.repositories = [];
17 if (!commitLog) 18 if (!commitLog)
18 return; 19 return;
19 20
20 var allRepositories = commitLog._repositories.names; 21 var allRepositories = commitLog._repositories.names;
21 for (var i = 0; i < allRepositories.length; i++) { 22 for (var i = 0; i < allRepositories.length; i++) {
22 var repository = allRepositories[i]; 23 var repository = allRepositories[i];
23 if (!this.revisions[repository]) 24 if (!this.revisions[repository])
24 continue; 25 continue;
25 26
26 var commits = commitLog.range(repository, this.revisions[repository]); 27 var commits = commitLog.range(repository, this.revisions[repository]);
27 if (!commits.length) 28 if (!commits.length)
28 continue; 29 continue;
29 30
30 this.repositories.push({ 31 this.repositories.push(new CTRepositoryCommitList(repository, commits));
31 name: repository,
32 range: this._displayRange(commits, repository),
33 commits: commits,
34 expanded: false
35 });
36 } 32 }
37 }; 33 };
38 34
39 CTCommitList.prototype._initRevisions = function(repoRevisions) { 35 CTCommitList.prototype._initRevisions = function(repoRevisions) {
40 this.revisions = {}; 36 this.revisions = {};
41 repoRevisions.forEach(function(repoRevision) { 37 repoRevisions.forEach(function(repoRevision) {
42 var split = repoRevision.split(':'); 38 var split = repoRevision.split(':');
43 var repo = split[0]; 39 var repo = split[0];
44 var revision = parseInt(split[1], 10); 40 var revision = parseInt(split[1], 10);
45 if (revision && repo) { 41 if (revision && repo) {
46 if (!this.revisions[repo]) { 42 if (!this.revisions[repo]) {
47 this.revisions[repo] = [revision]; 43 this.revisions[repo] = [revision];
48 } else { 44 } else {
49 this.revisions[repo].push(revision); 45 this.revisions[repo].push(revision);
50 } 46 }
51 } 47 }
52 }.bind(this)); 48 }.bind(this));
53 }; 49 };
54 50
55 CTCommitList.prototype._displayRange = function(commits) {
56 return commits.first().revision + " : " + commits.last().revision;
57 };
58
59 </script> 51 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698