<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[213003] trunk/Websites/perf.webkit.org</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/213003">213003</a></dd>
<dt>Author</dt> <dd>dewei_zhu@apple.com</dd>
<dt>Date</dt> <dd>2017-02-25 00:58:18 -0800 (Sat, 25 Feb 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>Commit should order by 'commit_order' as secondary key.
https://bugs.webkit.org/show_bug.cgi?id=168866
Reviewed by Ryosuke Niwa.
Currently, commits are sorted by 'commit_time' only.
We should use 'commit_order' as secondary key when 'commit_time' is equal or null.
* public/include/commit-log-fetcher.php:
* public/include/db.php:
* server-tests/api-commits.js:
(return.addSlaveForReport.subversionCommits.then):
(then):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebsitesperfwebkitorgChangeLog">trunk/Websites/perf.webkit.org/ChangeLog</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicincludecommitlogfetcherphp">trunk/Websites/perf.webkit.org/public/include/commit-log-fetcher.php</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicincludedbphp">trunk/Websites/perf.webkit.org/public/include/db.php</a></li>
<li><a href="#trunkWebsitesperfwebkitorgservertestsapicommitsjs">trunk/Websites/perf.webkit.org/server-tests/api-commits.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebsitesperfwebkitorgChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/ChangeLog (213002 => 213003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/ChangeLog        2017-02-25 08:44:43 UTC (rev 213002)
+++ trunk/Websites/perf.webkit.org/ChangeLog        2017-02-25 08:58:18 UTC (rev 213003)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2017-02-25 Dewei Zhu <dewei_zhu@apple.com>
+
+ Commit should order by 'commit_order' as secondary key.
+ https://bugs.webkit.org/show_bug.cgi?id=168866
+
+ Reviewed by Ryosuke Niwa.
+
+ Currently, commits are sorted by 'commit_time' only.
+ We should use 'commit_order' as secondary key when 'commit_time' is equal or null.
+
+ * public/include/commit-log-fetcher.php:
+ * public/include/db.php:
+ * server-tests/api-commits.js:
+ (return.addSlaveForReport.subversionCommits.then):
+ (then):
+
</ins><span class="cx"> 2017-02-24 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><span class="cx"> REGRESSION(r212853): Comparisons to baseline no longer shows up
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicincludecommitlogfetcherphp"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/include/commit-log-fetcher.php (213002 => 213003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/include/commit-log-fetcher.php        2017-02-25 08:44:43 UTC (rev 213002)
+++ trunk/Websites/perf.webkit.org/public/include/commit-log-fetcher.php        2017-02-25 08:58:18 UTC (rev 213003)
</span><span class="lines">@@ -84,15 +84,15 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function fetch_oldest($repository_id) {
</span><del>- return $this->format_single_commit($this->db->select_first_row('commits', 'commit', array('repository' => $repository_id), 'time'));
</del><ins>+ return $this->format_single_commit($this->db->select_first_row('commits', 'commit', array('repository' => $repository_id), array('time', 'order')));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function fetch_latest($repository_id) {
</span><del>- return $this->format_single_commit($this->db->select_last_row('commits', 'commit', array('repository' => $repository_id), 'time'));
</del><ins>+ return $this->format_single_commit($this->db->select_last_row('commits', 'commit', array('repository' => $repository_id), array('time', 'order')));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function fetch_last_reported($repository_id) {
</span><del>- return $this->format_single_commit($this->db->select_last_row('commits', 'commit', array('repository' => $repository_id, 'reported' => true), 'time'));
</del><ins>+ return $this->format_single_commit($this->db->select_last_row('commits', 'commit', array('repository' => $repository_id, 'reported' => true), array('time', 'order')));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function fetch_revision($repository_id, $revision) {
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicincludedbphp"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/include/db.php (213002 => 213003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/include/db.php        2017-02-25 08:44:43 UTC (rev 213002)
+++ trunk/Websites/perf.webkit.org/public/include/db.php        2017-02-25 08:58:18 UTC (rev 213003)
</span><span class="lines">@@ -180,7 +180,7 @@
</span><span class="cx"> }
</span><span class="cx"> if (!$rows && $should_insert) {
</span><span class="cx"> $rows = $this->query_and_fetch_all("INSERT INTO $table ($insert_column_names) SELECT $insert_placeholders
</span><del>- WHERE NOT EXISTS ($query) RETURNING $returning_column_name", $values);
</del><ins>+ WHERE NOT EXISTS ($query) RETURNING $returning_column_name", $values);
</ins><span class="cx"> }
</span><span class="cx"> if (!$should_update && !$rows)
</span><span class="cx"> $rows = $this->query_and_fetch_all($query, $select_values);
</span><span class="lines">@@ -212,10 +212,16 @@
</span><span class="cx"> $column_names = $placeholders = '1';
</span><span class="cx"> $query = "SELECT * FROM $table WHERE ($column_names) = ($placeholders)";
</span><span class="cx"> if ($order_by) {
</span><del>- assert(ctype_alnum_underscore($order_by));
- $query .= ' ORDER BY ' . $this->prefixed_name($order_by, $prefix);
- if ($descending_order)
- $query .= ' DESC';
</del><ins>+ if (!is_array($order_by))
+ $order_by = array($order_by);
+
+ $order_columns = array();
+ foreach ($order_by as $order_key) {
+ assert(ctype_alnum_underscore($order_key));
+ $order_column = $this->prefixed_name($order_key, $prefix) . ' ' . ($descending_order? 'DESC' : 'ASC');
+ array_push($order_columns, $order_column);
+ }
+ $query .= ' ORDER BY ' . join(', ', $order_columns);
</ins><span class="cx"> }
</span><span class="cx"> if ($offset !== NULL)
</span><span class="cx"> $query .= ' OFFSET ' . intval($offset);
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgservertestsapicommitsjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/server-tests/api-commits.js (213002 => 213003)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/server-tests/api-commits.js        2017-02-25 08:44:43 UTC (rev 213002)
+++ trunk/Websites/perf.webkit.org/server-tests/api-commits.js        2017-02-25 08:58:18 UTC (rev 213003)
</span><span class="lines">@@ -39,6 +39,43 @@
</span><span class="cx"> ]
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ const systemVersionCommits = {
+ "slaveName": "someSlave",
+ "slavePassword": "somePassword",
+ "commits": [
+ {
+ "repository": "OSX",
+ "revision": "16D32",
+ "order": 6
+ },
+ {
+ "repository": "OSX",
+ "revision": "16C68",
+ "order": 5
+ },
+ {
+ "repository": "OSX",
+ "revision": "16C67",
+ "order": 4
+ },
+ {
+ "repository": "OSX",
+ "revision": "16B2657",
+ "order": 3
+ },
+ {
+ "repository": "OSX",
+ "revision": "16B2555",
+ "order": 2
+ },
+ {
+ "repository": "OSX",
+ "revision": "16A323",
+ "order": 1
+ }
+ ]
+ }
+
</ins><span class="cx"> const notYetReportedCommit = {
</span><span class="cx"> revision: '210951',
</span><span class="cx"> time: '2017-01-20T03:56:20.045Z'
</span><span class="lines">@@ -96,6 +133,26 @@
</span><span class="cx"> assert.equal(commits[2]['previousCommit'], commits[1]['id']);
</span><span class="cx"> });
</span><span class="cx"> });
</span><ins>+
+ it("should return the list of ordered commits for a given repository", () => {
+ return addSlaveForReport(subversionCommits).then(() => {
+ return TestServer.remoteAPI().postJSON('/api/report-commits/', systemVersionCommits);
+ }).then(function (response) {
+ assert.equal(response['status'], 'OK');
+ return TestServer.remoteAPI().getJSON('/api/commits/OSX/');
+ }).then(function (result) {
+ assert.equal(result['status'], 'OK');
+ const commits = result['commits'];
+ const submittedCommits = systemVersionCommits['commits'];
+ assert.equal(commits.length, submittedCommits.length);
+ assert.equal(commits[0]['revision'], submittedCommits[5]['revision']);
+ assert.equal(commits[1]['revision'], submittedCommits[4]['revision']);
+ assert.equal(commits[2]['revision'], submittedCommits[3]['revision']);
+ assert.equal(commits[3]['revision'], submittedCommits[2]['revision']);
+ assert.equal(commits[4]['revision'], submittedCommits[1]['revision']);
+ assert.equal(commits[5]['revision'], submittedCommits[0]['revision']);
+ });
+ });
</ins><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> describe('/api/commits/<repository>/oldest', () => {
</span><span class="lines">@@ -126,6 +183,19 @@
</span><span class="cx"> assertCommitIsSameAsOneSubmitted(result['commits'][0], subversionCommits['commits'][0]);
</span><span class="cx"> });
</span><span class="cx"> });
</span><ins>+
+ it("should return the oldest commit based on 'commit_order' when 'commit_time' is missing", () => {
+ const remote = TestServer.remoteAPI();
+ return addSlaveForReport(systemVersionCommits).then(() => {
+ return remote.postJSONWithStatus('/api/report-commits/', systemVersionCommits);
+ }).then(() => {
+ return remote.getJSON('/api/commits/OSX/oldest');
+ }).then(function (result) {
+ assert.equal(result['status'], 'OK');
+ assert.equal(result['commits'].length, 1);
+ assert.equal(result['commits'][0]['revision'], systemVersionCommits['commits'][5]['revision']);
+ });
+ });
</ins><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> describe('/api/commits/<repository>/latest', () => {
</span><span class="lines">@@ -156,6 +226,19 @@
</span><span class="cx"> assertCommitIsSameAsOneSubmitted(result['commits'][0], subversionCommits['commits'].slice().pop());
</span><span class="cx"> });
</span><span class="cx"> });
</span><ins>+
+ it("should return the latest commit based on 'commit_order' when 'commit_time' is missing", () => {
+ const remote = TestServer.remoteAPI();
+ return addSlaveForReport(systemVersionCommits).then(() => {
+ return remote.postJSONWithStatus('/api/report-commits/', systemVersionCommits);
+ }).then(() => {
+ return remote.getJSON('/api/commits/OSX/latest');
+ }).then(function (result) {
+ assert.equal(result['status'], 'OK');
+ assert.equal(result['commits'].length, 1);
+ assert.equal(result['commits'][0]['revision'], systemVersionCommits['commits'][0]['revision']);
+ });
+ });
</ins><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> describe('/api/commits/<repository>/last-reported', () => {
</span><span class="lines">@@ -204,6 +287,19 @@
</span><span class="cx"> assertCommitIsSameAsOneSubmitted(result['commits'][0], subversionCommits['commits'].slice().pop());
</span><span class="cx"> });
</span><span class="cx"> });
</span><ins>+
+ it("should return the last reported commit based on 'commit_order' when 'commit_time' is missing", () => {
+ const remote = TestServer.remoteAPI();
+ return addSlaveForReport(systemVersionCommits).then(() => {
+ return remote.postJSONWithStatus('/api/report-commits/', systemVersionCommits);
+ }).then(() => {
+ return remote.getJSON('/api/commits/OSX/last-reported');
+ }).then(function (result) {
+ assert.equal(result['status'], 'OK');
+ assert.equal(result['commits'].length, 1);
+ assert.equal(result['commits'][0]['revision'], systemVersionCommits['commits'][0]['revision']);
+ });
+ });
</ins><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> describe('/api/commits/<repository>/<commit>', () => {
</span></span></pre>
</div>
</div>
</body>
</html>