Title: [224227] trunk/Websites/perf.webkit.org
Revision
224227
Author
dewei_...@apple.com
Date
2017-10-31 02:44:39 -0700 (Tue, 31 Oct 2017)

Log Message

OwnedCommitViewer should include the preceding commit.
https://bugs.webkit.org/show_bug.cgi?id=179047

Reviewed by Ryosuke Niwa.

OwnedCommitViewer shows the difference between owned commits.
To show changes made by first owned commit, we need to have the preceding commit information.

* public/v3/components/commit-log-viewer.js:
(CommitLogViewer):
(CommitLogViewer.prototype._fetchCommitLogs): Fetch preceding commit if the commits fetched is not a single commit.
(CommitLogViewer.prototype.render):
(CommitLogViewer.prototype._renderCommitList): Conditionally rendering preceding commit in commit list.

Modified Paths

Diff

Modified: trunk/Websites/perf.webkit.org/ChangeLog (224226 => 224227)


--- trunk/Websites/perf.webkit.org/ChangeLog	2017-10-31 09:39:32 UTC (rev 224226)
+++ trunk/Websites/perf.webkit.org/ChangeLog	2017-10-31 09:44:39 UTC (rev 224227)
@@ -1,3 +1,19 @@
+2017-10-31  Dewei Zhu  <dewei_...@apple.com>
+
+        OwnedCommitViewer should include the preceding commit.
+        https://bugs.webkit.org/show_bug.cgi?id=179047
+
+        Reviewed by Ryosuke Niwa.
+
+        OwnedCommitViewer shows the difference between owned commits.
+        To show changes made by first owned commit, we need to have the preceding commit information.
+
+        * public/v3/components/commit-log-viewer.js:
+        (CommitLogViewer):
+        (CommitLogViewer.prototype._fetchCommitLogs): Fetch preceding commit if the commits fetched is not a single commit.
+        (CommitLogViewer.prototype.render):
+        (CommitLogViewer.prototype._renderCommitList): Conditionally rendering preceding commit in commit list.
+
 2017-10-24  Dewei Zhu  <dewei_...@apple.com>
 
         Fix a bug in syncing script that test/build syncer is never set.

Modified: trunk/Websites/perf.webkit.org/public/v3/components/commit-log-viewer.js (224226 => 224227)


--- trunk/Websites/perf.webkit.org/public/v3/components/commit-log-viewer.js	2017-10-31 09:39:32 UTC (rev 224226)
+++ trunk/Websites/perf.webkit.org/public/v3/components/commit-log-viewer.js	2017-10-31 09:44:39 UTC (rev 224227)
@@ -8,6 +8,7 @@
         this._repository = null;
         this._fetchingPromise = null;
         this._commits = null;
+        this._precedingCommit = null;
         this._renderCommitListLazily = new LazilyEvaluatedFunction(this._renderCommitList.bind(this));
         this._showRepositoryName = true;
     }
@@ -35,7 +36,8 @@
         }
 
         let promise;
-        if (!precedingRevision || precedingRevision == lastRevision)
+        const fetchSingleCommit = !precedingRevision || precedingRevision == lastRevision;
+        if (fetchSingleCommit)
             promise = CommitLog.fetchForSingleRevision(repository, lastRevision);
         else
             promise = CommitLog.fetchBetweenRevisions(repository, precedingRevision, lastRevision);
@@ -46,9 +48,26 @@
         this._fetchingPromise.then((commits) => {
             if (this._fetchingPromise != promise)
                 return;
-            this._fetchingPromise = null;
             this._commits = commits;
-            this.enqueueToRender();
+            if (fetchSingleCommit) {
+                this._fetchingPromise = null;
+                this._precedingCommit = null;
+                this.enqueueToRender();
+                return;
+            }
+            return CommitLog.fetchForSingleRevision(repository, precedingRevision).then((precedingCommit) => {
+                if (this._fetchingPromise != promise)
+                    return;
+                this._fetchingPromise = null;
+                this._precedingCommit = precedingCommit[0];
+                this.enqueueToRender();
+            }, (error) => {
+                if (this._fetchingPromise != promise)
+                    return;
+                this._fetchingPromise = null;
+                this._precedingCommit = null;
+                this.enqueueToRender();
+            });
         }, (error) => {
             if (this._fetchingPromise != promise)
                 return;
@@ -65,13 +84,14 @@
         const shouldShowRepositoryName = this._repository && (this._commits || this._fetchingPromise) && this._showRepositoryName;
         this.content('repository-name').textContent = shouldShowRepositoryName ? this._repository.name() : '';
         this.content('spinner-container').style.display = this._fetchingPromise ? null : 'none';
-        this._renderCommitListLazily.evaluate(this._commits);
+        this._renderCommitListLazily.evaluate(this._commits, this._precedingCommit);
     }
 
-    _renderCommitList(commits)
+    _renderCommitList(commits, precedingCommit)
     {
         const element = ComponentBase.createElement;
         const link = ComponentBase.createLink;
+        commits = commits && precedingCommit && precedingCommit.ownsCommits() ? [precedingCommit].concat(commits) : commits;
         let previousCommit = null;
 
         this.renderReplace(this.content('commits-list'), (commits || []).map((commit) => {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to