<!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>[174711] 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/174711">174711</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2014-10-14 16:46:45 -0700 (Tue, 14 Oct 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>New perf dashboard should have an ability to search commits by a keyword
https://bugs.webkit.org/show_bug.cgi?id=137675

Reviewed by Geoffrey Garen.

/api/commits/ now accepts query parameters to search a commit by a keyword. Its output format changed to
include &quot;authorEmail&quot; and &quot;authorName&quot; directly as columns instead of including an &quot;author&quot; object.
This API change allows fetch_commits_between to generate results without processing Postgres query results.

In the front end side, we've added a search pane in pane controller, and the interactive chart component
now has a concept of highlighted items which is used to indicate commits found by the search pane.

* public/api/commits.php:
(main): Extract query parameters: keyword, from, and to and use that to fetch appropriate commits.
(fetch_commits_between): Moved some code from main. Now takes a search term as the third argument.
We look for a commit if its author name or email contains the keyword or if its revision matches the keyword.
(format_commit): Renamed from format_commits. Now only formats one commit.

* public/include/db.php:
(Database::query_and_fetch_all): Now returns array() when the query results is empty (instead of false).

* public/v2/app.css: Renamed .close-button to .icon-button since it's used by a search button as well.

* public/v2/app.js:
(App.Pane.searchCommit): Added. Finds the commits by a search term and assigns 'highlightedItems',
which is a hash table that contains highlighted items' measurements' ids as keys.
(App.PaneController.actions.toggleSearch): Toggles the visibility of the search pane. Also sets
the default commit repository.
(App.PaneController.actions.searchCommit): Delegates the work to App.Pane.searchCommit.
(App.InteractiveChartComponent._constructGraphIfPossible): Fixed a bug that we weren't removing old this._dots.
Added the code to initialize this._highlights.
(App.InteractiveChartComponent._updateDimensionsIfNeeded): Updates dimensions of highlight lines.
(App.InteractiveChartComponent._updateHighlightPositions): Added. Ditto.
(App.InteractiveChartComponent._highlightedItemsChanged): Adds vertical lines for highlighted items and deletes
the existing lines for the old highlighted items.
(App.CommitsViewerComponent.commitsChanged): Updated the code per JSON API change mentioned above.
Also fixed a bug that the code tries to update the commits viewer even if the viewer had already been destroyed. 

* public/v2/chart-pane.css: Added style for the search pane and the search button.

* public/v2/data.js: Turned FetchCommitsForTimeRange into a class: CommitLogs.
(CommitLogs): Added.
(CommitLogs.fetchForTimeRange): Renamed from FetchCommitsForTimeRange. Takes a search term as an argument.
(CommitLogs._cachedCommitsBetween): Extracted from FetchCommitsForTimeRange.
(CommitLogs._cacheConsecutiveCommits): Ditto.
(FetchCommitsForTimeRange._cachedCommitsByRepository): Deleted.
(Measurement.prototype.commitTimeForRepository): Extracted from formattedRevisions.
(Measurement.prototype.formattedRevisions): Uses formattedRevisions. Deleted the unused code for commitTime.

* public/v2/index.html: Added the search pane and the search button. Also removed the unused attribute binding
for showingDetails since this property is no longer used.

* public/v2/manifest.js:
(App.Manifest.repositories): Added.
(App.Manifest.repositoriesWithReportedCommits): Ditto. Used by App.PaneController.actions.toggleSearch to find
the default repository to search.
(App.Manifest._fetchedManifest): Populates repositories and repositoriesWithReportedCommits.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebsitesperfwebkitorgChangeLog">trunk/Websites/perf.webkit.org/ChangeLog</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicapicommitsphp">trunk/Websites/perf.webkit.org/public/api/commits.php</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicincludedbphp">trunk/Websites/perf.webkit.org/public/include/db.php</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv2appcss">trunk/Websites/perf.webkit.org/public/v2/app.css</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv2appjs">trunk/Websites/perf.webkit.org/public/v2/app.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv2chartpanecss">trunk/Websites/perf.webkit.org/public/v2/chart-pane.css</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv2datajs">trunk/Websites/perf.webkit.org/public/v2/data.js</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv2indexhtml">trunk/Websites/perf.webkit.org/public/v2/index.html</a></li>
<li><a href="#trunkWebsitesperfwebkitorgpublicv2manifestjs">trunk/Websites/perf.webkit.org/public/v2/manifest.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 (174710 => 174711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/ChangeLog        2014-10-14 23:43:54 UTC (rev 174710)
+++ trunk/Websites/perf.webkit.org/ChangeLog        2014-10-14 23:46:45 UTC (rev 174711)
</span><span class="lines">@@ -1,5 +1,65 @@
</span><span class="cx"> 2014-10-13  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span><span class="cx"> 
</span><ins>+        New perf dashboard should have an ability to search commits by a keyword
+        https://bugs.webkit.org/show_bug.cgi?id=137675
+
+        Reviewed by Geoffrey Garen.
+
+        /api/commits/ now accepts query parameters to search a commit by a keyword. Its output format changed to
+        include &quot;authorEmail&quot; and &quot;authorName&quot; directly as columns instead of including an &quot;author&quot; object.
+        This API change allows fetch_commits_between to generate results without processing Postgres query results.
+
+        In the front end side, we've added a search pane in pane controller, and the interactive chart component
+        now has a concept of highlighted items which is used to indicate commits found by the search pane.
+
+        * public/api/commits.php:
+        (main): Extract query parameters: keyword, from, and to and use that to fetch appropriate commits.
+        (fetch_commits_between): Moved some code from main. Now takes a search term as the third argument.
+        We look for a commit if its author name or email contains the keyword or if its revision matches the keyword.
+        (format_commit): Renamed from format_commits. Now only formats one commit.
+
+        * public/include/db.php:
+        (Database::query_and_fetch_all): Now returns array() when the query results is empty (instead of false).
+
+        * public/v2/app.css: Renamed .close-button to .icon-button since it's used by a search button as well.
+
+        * public/v2/app.js:
+        (App.Pane.searchCommit): Added. Finds the commits by a search term and assigns 'highlightedItems',
+        which is a hash table that contains highlighted items' measurements' ids as keys.
+        (App.PaneController.actions.toggleSearch): Toggles the visibility of the search pane. Also sets
+        the default commit repository.
+        (App.PaneController.actions.searchCommit): Delegates the work to App.Pane.searchCommit.
+        (App.InteractiveChartComponent._constructGraphIfPossible): Fixed a bug that we weren't removing old this._dots.
+        Added the code to initialize this._highlights.
+        (App.InteractiveChartComponent._updateDimensionsIfNeeded): Updates dimensions of highlight lines.
+        (App.InteractiveChartComponent._updateHighlightPositions): Added. Ditto.
+        (App.InteractiveChartComponent._highlightedItemsChanged): Adds vertical lines for highlighted items and deletes
+        the existing lines for the old highlighted items.
+        (App.CommitsViewerComponent.commitsChanged): Updated the code per JSON API change mentioned above.
+        Also fixed a bug that the code tries to update the commits viewer even if the viewer had already been destroyed. 
+
+        * public/v2/chart-pane.css: Added style for the search pane and the search button.
+
+        * public/v2/data.js: Turned FetchCommitsForTimeRange into a class: CommitLogs.
+        (CommitLogs): Added.
+        (CommitLogs.fetchForTimeRange): Renamed from FetchCommitsForTimeRange. Takes a search term as an argument.
+        (CommitLogs._cachedCommitsBetween): Extracted from FetchCommitsForTimeRange.
+        (CommitLogs._cacheConsecutiveCommits): Ditto.
+        (FetchCommitsForTimeRange._cachedCommitsByRepository): Deleted.
+        (Measurement.prototype.commitTimeForRepository): Extracted from formattedRevisions.
+        (Measurement.prototype.formattedRevisions): Uses formattedRevisions. Deleted the unused code for commitTime.
+
+        * public/v2/index.html: Added the search pane and the search button. Also removed the unused attribute binding
+        for showingDetails since this property is no longer used.
+
+        * public/v2/manifest.js:
+        (App.Manifest.repositories): Added.
+        (App.Manifest.repositoriesWithReportedCommits): Ditto. Used by App.PaneController.actions.toggleSearch to find
+        the default repository to search.
+        (App.Manifest._fetchedManifest): Populates repositories and repositoriesWithReportedCommits.
+
+2014-10-13  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
</ins><span class="cx">         Unreviewed build fix after r174555.
</span><span class="cx"> 
</span><span class="cx">         * public/include/manifest.php:
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicapicommitsphp"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/api/commits.php (174710 => 174711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/api/commits.php        2014-10-14 23:43:54 UTC (rev 174710)
+++ trunk/Websites/perf.webkit.org/public/api/commits.php        2014-10-14 23:46:45 UTC (rev 174711)
</span><span class="lines">@@ -20,7 +20,10 @@
</span><span class="cx">     $single_commit = NULL;
</span><span class="cx">     $commits = array();
</span><span class="cx">     if (!$filter) {
</span><del>-        $commits = $db-&gt;fetch_table('commits', 'commit_time');
</del><ins>+        $keyword = array_get($_GET, 'keyword');
+        $from = array_get($_GET, 'from');
+        $to = array_get($_GET, 'to');
+        $commits = fetch_commits_between($db, $repository_id, $from, $to, $keyword);
</ins><span class="cx">     } else if ($filter == 'oldest') {
</span><span class="cx">         $single_commit = $db-&gt;select_first_row('commits', 'commit', array('repository' =&gt; $repository_id), 'time');
</span><span class="cx">     } else if ($filter == 'latest') {
</span><span class="lines">@@ -28,20 +31,16 @@
</span><span class="cx">     } else if ($filter == 'last-reported') {
</span><span class="cx">         $single_commit = $db-&gt;select_last_row('commits', 'commit', array('repository' =&gt; $repository_id, 'reported' =&gt; true), 'time');
</span><span class="cx">     } else if (ctype_alnum($filter)) {
</span><del>-        $single_commit = commit_from_revision($db, $repository_id, $repository_name, $filter);
</del><ins>+        $single_commit = commit_from_revision($db, $repository_id, $filter);
</ins><span class="cx">     } else {
</span><span class="cx">         $matches = array();
</span><span class="cx">         if (!preg_match('/([A-Za-z0-9]+)[\:\-]([A-Za-z0-9]+)/', $filter, $matches))
</span><span class="cx">             exit_with_error('UnknownFilter', array('repositoryName' =&gt; $repository_name, 'filter' =&gt; $filter));
</span><span class="cx"> 
</span><del>-        $first = commit_from_revision($db, $repository_id, $matches[1])['commit_time'];
-        $second = commit_from_revision($db, $repository_id, $matches[2])['commit_time'];
-        $in_order = $first &lt; $second;
-
-        $commits = fetch_commits_between($db, $repository_id, $in_order ? $first : $second, $in_order ? $second : $first);
</del><ins>+        $commits = fetch_commits_between($db, $repository_id, $matches[1], $matches[2]);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    exit_with_success(array('commits' =&gt; format_commits($single_commit ? array($single_commit) : $commits)));
</del><ins>+    exit_with_success(array('commits' =&gt; $single_commit ? format_commit($single_commit) : $commits));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function commit_from_revision($db, $repository_id, $revision) {
</span><span class="lines">@@ -55,28 +54,51 @@
</span><span class="cx">     return $row;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function fetch_commits_between($db, $repository_id, $from, $to) {
-    $commits = $db-&gt;query_and_fetch_all('SELECT * FROM commits
-        WHERE commit_repository = $1 AND commit_time &gt;= $2 AND commit_time &lt;= $3 AND commit_reported = true ORDER BY commit_time',
-        array($repository_id, $from, $to));
-    if (!$commits)
-        exit_with_error('FailedToFetchCommits', array('repository' =&gt; $repository_id, 'from' =&gt; $from, 'to' =&gt; $to));
</del><ins>+function fetch_commits_between($db, $repository_id, $first, $second, $keyword = NULL) {
+    $statements = 'SELECT commit_id as &quot;id&quot;,
+        commit_revision as &quot;revision&quot;,
+        commit_parent as &quot;parent&quot;,
+        commit_time as &quot;time&quot;,
+        commit_author_name as &quot;authorName&quot;,
+        commit_author_email as &quot;authorEmail&quot;,
+        commit_message as &quot;message&quot;
+        FROM commits WHERE commit_repository = $1 AND commit_reported = true';
+    $values = array($repository_id);
+
+    if ($first &amp;&amp; $second) {
+        $first = commit_from_revision($db, $repository_id, $first)['commit_time'];
+        $second = commit_from_revision($db, $repository_id, $second)['commit_time'];
+        $in_order = $first &lt; $second;
+        array_push($values, $in_order ? $first : $second);
+        $statements .= ' AND commit_time &gt;= $' . count($values);
+        array_push($values, $in_order ? $second : $first);
+        $statements .= ' AND commit_time &lt;= $' . count($values);
+    }
+
+    if ($keyword) {
+        array_push($values, '%' . str_replace(array('\\', '_', '@'), array('\\\\', '\\_', '\\%'), $keyword) . '%');
+        $index = '$' . count($values);
+        $statements .= &quot; AND (commit_author_name LIKE $index OR commit_author_email LIKE $index&quot;;
+        array_push($values, ltrim($keyword, 'r'));
+        $statements .= ' OR commit_revision = $' . count($values) . ')';
+    }
+
+    $commits = $db-&gt;query_and_fetch_all($statements . ' ORDER BY commit_time', $values);
+    if (!is_array($commits))
+        exit_with_error('FailedToFetchCommits', array('repository' =&gt; $repository_id, 'first' =&gt; $first, 'second' =&gt; $second));
</ins><span class="cx">     return $commits;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function format_commits($commits) {
-    $formatted_commits = array();
-    foreach ($commits as $commit_row) {
-        array_push($formatted_commits, array(
-            'id' =&gt; $commit_row['commit_id'],
-            'revision' =&gt; $commit_row['commit_revision'],
-            'parent' =&gt; $commit_row['commit_parent'],
-            'time' =&gt; $commit_row['commit_time'],
-            'author' =&gt; array('name' =&gt; $commit_row['commit_author_name'], 'email' =&gt; $commit_row['commit_author_email']),
-            'message' =&gt; $commit_row['commit_message']
-        ));
-    }
-    return $formatted_commits;
</del><ins>+function format_commit($commit_row) {
+    return array(array(
+        'id' =&gt; $commit_row['commit_id'],
+        'revision' =&gt; $commit_row['commit_revision'],
+        'parent' =&gt; $commit_row['commit_parent'],
+        'time' =&gt; $commit_row['commit_time'],
+        'authorName' =&gt; $commit_row['commit_author_name'],
+        'authorEmail' =&gt; $commit_row['commit_author_email'],
+        'message' =&gt; $commit_row['commit_message']
+    ));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> main(array_key_exists('PATH_INFO', $_SERVER) ? explode('/', trim($_SERVER['PATH_INFO'], '/')) : array());
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicincludedbphp"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/include/db.php (174710 => 174711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/include/db.php        2014-10-14 23:43:54 UTC (rev 174710)
+++ trunk/Websites/perf.webkit.org/public/include/db.php        2014-10-14 23:46:45 UTC (rev 174711)
</span><span class="lines">@@ -185,10 +185,12 @@
</span><span class="cx"> 
</span><span class="cx">     function query_and_fetch_all($query, $params = array()) {
</span><span class="cx">         if (!$this-&gt;connection)
</span><del>-            return false;
</del><ins>+            return NULL;
</ins><span class="cx">         $result = pg_query_params($this-&gt;connection, $query, $params);
</span><span class="cx">         if (!$result)
</span><del>-            return false;
</del><ins>+            return NULL;
+        if (pg_num_rows($result) == 0)
+            return array();
</ins><span class="cx">         return pg_fetch_all($result);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv2appcss"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v2/app.css (174710 => 174711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v2/app.css        2014-10-14 23:43:54 UTC (rev 174710)
+++ trunk/Websites/perf.webkit.org/public/v2/app.css        2014-10-14 23:46:45 UTC (rev 174711)
</span><span class="lines">@@ -115,14 +115,14 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-.close-button {
</del><ins>+.icon-button {
</ins><span class="cx">     width: 1rem;
</span><span class="cx">     height: 1rem;
</span><span class="cx"> }
</span><del>-.close-button g {
</del><ins>+.icon-button g {
</ins><span class="cx">     stroke: #ccc;
</span><span class="cx"> }
</span><del>-.close-button:hover g {
</del><ins>+.icon-button:hover g {
</ins><span class="cx">     stroke: #666;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv2appjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v2/app.js (174710 => 174711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v2/app.js        2014-10-14 23:43:54 UTC (rev 174710)
+++ trunk/Websites/perf.webkit.org/public/v2/app.js        2014-10-14 23:46:45 UTC (rev 174711)
</span><span class="lines">@@ -287,9 +287,36 @@
</span><span class="cx">     metricId: null,
</span><span class="cx">     metric: null,
</span><span class="cx">     selectedItem: null,
</span><del>-    init: function ()
-    {
-        this._super();
</del><ins>+    searchCommit: function (repository, keyword) {
+        var self = this;
+        var repositoryName = repository.get('id');
+        CommitLogs.fetchForTimeRange(repositoryName, null, null, keyword).then(function (commits) {
+            if (self.isDestroyed || !self.get('chartData') || !commits.length)
+                return;
+            var currentRuns = self.get('chartData').current.timeSeriesByCommitTime().series();
+            if (!currentRuns.length)
+                return;
+
+            var highlightedItems = {};
+            var commitIndex = 0;
+            for (var runIndex = 0; runIndex &lt; currentRuns.length &amp;&amp; commitIndex &lt; commits.length; runIndex++) {
+                var measurement = currentRuns[runIndex].measurement;
+                var commitTime = measurement.commitTimeForRepository(repositoryName);
+                if (!commitTime)
+                    continue;
+                if (commits[commitIndex].time &lt;= commitTime) {
+                    highlightedItems[measurement.id()] = true;
+                    do {
+                        commitIndex++;
+                    } while (commitIndex &lt; commits.length &amp;&amp; commits[commitIndex].time &lt;= commitTime);
+                }
+            }
+
+            self.set('highlightedItems', highlightedItems);
+        }, function () {
+            // FIXME: Report errors
+            this.set('highlightedItems', {});
+        });
</ins><span class="cx">     },
</span><span class="cx">     _fetch: function () {
</span><span class="cx">         var platformId = this.get('platformId');
</span><span class="lines">@@ -646,6 +673,19 @@
</span><span class="cx">         {
</span><span class="cx">             this.parentController.removePane(this.get('model'));
</span><span class="cx">         },
</span><ins>+        toggleSearch: function ()
+        {
+            if (!App.Manifest.repositoriesWithReportedCommits)
+                return;
+            var model = this.get('model');
+            if (!model.get('commitSearchRepository'))
+                model.set('commitSearchRepository', App.Manifest.repositoriesWithReportedCommits[0]);
+            this.toggleProperty('showingSearchPane');
+        },
+        searchCommit: function () {
+            var model = this.get('model');
+            model.searchCommit(model.get('commitSearchRepository'), model.get('commitSearchKeyword'));                
+        },
</ins><span class="cx">         zoomed: function (selection)
</span><span class="cx">         {
</span><span class="cx">             this.set('mainPlotDomain', selection ? selection : this.get('overviewDomain'));
</span><span class="lines">@@ -843,7 +883,12 @@
</span><span class="cx">         if (this._areas)
</span><span class="cx">             this._areas.forEach(function (area) { area.remove(); });
</span><span class="cx">         this._areas = [];
</span><ins>+        if (this._dots)
+            this._dots.forEach(function (dot) { dots.remove(); });
</ins><span class="cx">         this._dots = [];
</span><ins>+        if (this._highlights)
+            this._highlights.forEach(function (highlight) { _highlights.remove(); });
+        this._highlights = [];
</ins><span class="cx"> 
</span><span class="cx">         this._currentTimeSeries = chartData.current.timeSeriesByCommitTime();
</span><span class="cx">         this._currentTimeSeriesData = this._currentTimeSeries.series();
</span><span class="lines">@@ -1018,6 +1063,7 @@
</span><span class="cx">                 .attr(&quot;cx&quot;, function(measurement) { return xScale(measurement.time); })
</span><span class="cx">                 .attr(&quot;cy&quot;, function(measurement) { return yScale(measurement.value); });
</span><span class="cx">         });
</span><ins>+        this._updateHighlightPositions();
</ins><span class="cx"> 
</span><span class="cx">         if (this._brush) {
</span><span class="cx">             if (selection)
</span><span class="lines">@@ -1045,6 +1091,19 @@
</span><span class="cx">             .style(&quot;z-index&quot;, &quot;100&quot;)
</span><span class="cx">             .text(this._yAxisUnit);
</span><span class="cx">     },
</span><ins>+    _updateHighlightPositions: function () {
+        var xScale = this._x;
+        var yScale = this._y;
+        var y2 = this._margin.top + this._contentHeight;
+        this._highlights.forEach(function (highlight) {
+            highlight
+                .attr(&quot;y1&quot;, 0)
+                .attr(&quot;y2&quot;, y2)
+                .attr(&quot;y&quot;, function(measurement) { return yScale(measurement.value); })
+                .attr(&quot;x1&quot;, function(measurement) { return xScale(measurement.time); })
+                .attr(&quot;x2&quot;, function(measurement) { return xScale(measurement.time); });
+        });
+    },
</ins><span class="cx">     _computeXAxisDomain: function (timeSeries)
</span><span class="cx">     {
</span><span class="cx">         var extent = d3.extent(timeSeries, function(point) { return point.time; });
</span><span class="lines">@@ -1317,6 +1376,26 @@
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">     }.observes('selectedItem').on('init'),
</span><ins>+    _highlightedItemsChanged: function () {
+        if (!this._margin)
+            return;
+
+        var highlightedItems = this.get('highlightedItems');
+
+        var data = this._currentTimeSeriesData.filter(function (item) { return highlightedItems[item.measurement.id()]; });
+
+        if (this._highlights)
+            this._highlights.forEach(function (highlight) { highlight.remove(); });
+
+        this._highlights.push(this._clippedContainer
+            .selectAll(&quot;.highlight&quot;)
+                .data(data)
+            .enter().append(&quot;line&quot;)
+                .attr(&quot;class&quot;, &quot;highlight&quot;));
+
+        this._updateHighlightPositions();
+
+    }.observes('highlightedItems'),
</ins><span class="cx">     _updateCurrentItemIndicators: function ()
</span><span class="cx">     {
</span><span class="cx">         if (!this._currentItemLine)
</span><span class="lines">@@ -1412,18 +1491,21 @@
</span><span class="cx">             return;
</span><span class="cx"> 
</span><span class="cx">         var self = this;
</span><del>-        FetchCommitsForTimeRange(repository, from, to).then(function (commits) {
</del><ins>+        CommitLogs.fetchForTimeRange(repository.get('id'), from, to).then(function (commits) {
+            if (self.isDestroyed)
+                return;
</ins><span class="cx">             self.set('commits', commits.map(function (commit) {
</span><span class="cx">                 return Ember.Object.create({
</span><span class="cx">                     repository: repository,
</span><span class="cx">                     revision: commit.revision,
</span><span class="cx">                     url: repository.urlForRevision(commit.revision),
</span><del>-                    author: commit.author.name || commit.author.email,
</del><ins>+                    author: commit.authorName || commit.authorEmail,
</ins><span class="cx">                     message: commit.message ? commit.message.substr(0, 75) : null,
</span><span class="cx">                 });
</span><span class="cx">             }));
</span><span class="cx">         }, function () {
</span><del>-            self.set('commits', []);
</del><ins>+            if (!self.isDestroyed)
+                self.set('commits', []);
</ins><span class="cx">         })
</span><span class="cx">     }.observes('repository').observes('revisionInfo').on('init'),
</span><span class="cx"> });
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv2chartpanecss"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v2/chart-pane.css (174710 => 174711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v2/chart-pane.css        2014-10-14 23:43:54 UTC (rev 174710)
+++ trunk/Websites/perf.webkit.org/public/v2/chart-pane.css        2014-10-14 23:46:45 UTC (rev 174711)
</span><span class="lines">@@ -5,6 +5,7 @@
</span><span class="cx">     padding: 0;
</span><span class="cx">     margin-bottom: 1rem;
</span><span class="cx">     outline: none;
</span><ins>+    position: relative;
</ins><span class="cx"> }
</span><span class="cx"> .chart-pane header {
</span><span class="cx">     background: #fff;
</span><span class="lines">@@ -49,6 +50,50 @@
</span><span class="cx">     top: 0.55rem;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.chart-pane a.search-button {
+    display: inline-block;
+    position: absolute;
+    right: 0.55rem;
+    top: 0.55rem;
+}
+
+.search-pane {
+    position: absolute;
+    right: 0rem;
+    top: 1.7rem;
+    border: 1px solid #bbb;
+    padding: 0;
+    border-radius: 0.5rem;
+    display: table;
+    background: white;
+}
+
+.search-pane.hidden {
+    display: none;
+}
+
+.search-pane input {
+    display: table-cell;
+    vertical-align: middle;
+    outline: none;
+    border: none;
+    border-top-right-radius: 0.5rem;
+    border-bottom-right-radius: 0.5rem;
+    padding: 0.5rem;
+    font-size: 1rem;
+    margin: 0;
+}
+
+.search-pane .repositories {
+    display: table-cell;
+    vertical-align: middle;
+    padding: 0 0.5rem;
+}
+
+.search-pane input:focus {
+    background-color: rgb(249, 242, 228);
+}
+
</ins><span class="cx"> .chart-pane .body {
</span><span class="cx">     position: relative;
</span><span class="cx">     width: 100%;
</span><span class="lines">@@ -222,6 +267,13 @@
</span><span class="cx">     fill: #f93;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.chart .highlight {
+    stroke: #39f;
+    stroke-dasharray: 4, 4;
+    stroke-width: 1px;
+    fill: none;
+}
+
</ins><span class="cx"> .chart .extent {
</span><span class="cx">     stroke: #9c6;
</span><span class="cx">     stroke-width: 1px;
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv2datajs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v2/data.js (174710 => 174711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v2/data.js        2014-10-14 23:43:54 UTC (rev 174710)
+++ trunk/Websites/perf.webkit.org/public/v2/data.js        2014-10-14 23:46:45 UTC (rev 174711)
</span><span class="lines">@@ -1,22 +1,30 @@
</span><span class="cx"> // We don't use DS.Model for these object types because we can't afford to process millions of them.
</span><span class="cx"> 
</span><del>-function FetchCommitsForTimeRange(repository, from, to)
</del><ins>+var CommitLogs = {
+    _cachedCommitsByRepository: {}
+};
+
+CommitLogs.fetchForTimeRange = function (repository, from, to, keyword)
</ins><span class="cx"> {
</span><del>-    var url = '../api/commits/' + repository.get('id') + '/' + from + '-' + to;
-
-    var cachedCommits = FetchCommitsForTimeRange._cachedCommitsByRepository[repository];
-    if (!cachedCommits) {
-        cachedCommits = {commitsByRevision: {}, commitsByTime: []};
-        FetchCommitsForTimeRange._cachedCommitsByRepository[repository] = cachedCommits;
</del><ins>+    var params = [];
+    if (from &amp;&amp; to) {
+        params.push(['from', from]);
+        params.push(['to', to]);
</ins><span class="cx">     }
</span><ins>+    if (keyword)
+        params.push(['keyword', keyword]);
</ins><span class="cx"> 
</span><del>-    if (cachedCommits) {
-        var startCommit = cachedCommits.commitsByRevision[from];
-        var endCommit = cachedCommits.commitsByRevision[to];
-        if (startCommit &amp;&amp; endCommit) {
-            return new Ember.RSVP.Promise(function (resolve) {
-                resolve(cachedCommits.commitsByTime.slice(startCommit.index, endCommit.index + 1)) });
-        }
</del><ins>+    // FIXME: We should be able to use the cache if all commits in the range have been cached.
+    var useCache = from &amp;&amp; to &amp;&amp; !keyword;
+
+    var url = '../api/commits/' + repository + '/?' + params.map(function (keyValue) {
+        return encodeURIComponent(keyValue[0]) + '=' + encodeURIComponent(keyValue[1]);
+    }).join('&amp;');
+
+    if (useCache) {
+        var cachedCommitsForRange = CommitLogs._cachedCommitsBetween(repository, from, to);
+        if (cachedCommitsForRange)
+            return new Ember.RSVP.Promise(function (resolve) { resolve(cachedCommitsForRange); });
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     console.log('Fecthing ' + url);
</span><span class="lines">@@ -28,26 +36,53 @@
</span><span class="cx">                 return;
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            data.commits.forEach(function (commit) {
-                if (cachedCommits.commitsByRevision[commit.revision])
-                    return;
-                commit.time = new Date(commit.time.replace(' ', 'T'));
-                cachedCommits.commitsByRevision[commit.revision] = commit;
-                cachedCommits.commitsByTime.push(commit);
-            });
</del><ins>+            var fetchedCommits = data.commits;
+            fetchedCommits.forEach(function (commit) { commit.time = new Date(commit.time.replace(' ', 'T')); });
</ins><span class="cx"> 
</span><del>-            cachedCommits.commitsByTime.sort(function (a, b) { return a.time - b.time; });
-            cachedCommits.commitsByTime.forEach(function (commit, index) { commit.index = index; });
</del><ins>+            if (useCache)
+                CommitLogs._cacheConsecutiveCommits(repository, from, to, fetchedCommits);
</ins><span class="cx"> 
</span><del>-            resolve(data.commits);
</del><ins>+            resolve(fetchedCommits);
</ins><span class="cx">         }).fail(function (xhr, status, error) {
</span><span class="cx">             reject(xhr.status + (error ? ', ' + error : ''));
</span><span class="cx">         })
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-FetchCommitsForTimeRange._cachedCommitsByRepository = {};
</del><ins>+CommitLogs._cachedCommitsBetween = function (repository, from, to)
+{
+    var cachedCommits = this._cachedCommitsByRepository[repository];
+    if (!cachedCommits)
+        return null;
</ins><span class="cx"> 
</span><ins>+    var startCommit = cachedCommits.commitsByRevision[from];
+    var endCommit = cachedCommits.commitsByRevision[to];
+    if (!startCommit || !endCommit)
+        return null;
+
+    return cachedCommits.commitsByTime.slice(startCommit.cacheIndex, endCommit.cacheIndex + 1);
+}
+
+CommitLogs._cacheConsecutiveCommits = function (repository, from, to, consecutiveCommits)
+{
+    var cachedCommits = this._cachedCommitsByRepository[repository];
+    if (!cachedCommits) {
+        cachedCommits = {commitsByRevision: {}, commitsByTime: []};
+        this._cachedCommitsByRepository[repository] = cachedCommits;
+    }
+
+    consecutiveCommits.forEach(function (commit) {
+        if (cachedCommits.commitsByRevision[commit.revision])
+            return;
+        cachedCommits.commitsByRevision[commit.revision] = commit;
+        cachedCommits.commitsByTime.push(commit);
+    });
+
+    cachedCommits.commitsByTime.sort(function (a, b) { return a.time - b.time; });
+    cachedCommits.commitsByTime.forEach(function (commit, index) { commit.cacheIndex = index; });
+}
+
+
</ins><span class="cx"> function Measurement(rawData)
</span><span class="cx"> {
</span><span class="cx">     this._raw = rawData;
</span><span class="lines">@@ -70,6 +105,15 @@
</span><span class="cx">     this._formattedRevisions = undefined;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+Measurement.prototype.commitTimeForRepository = function (repositoryName)
+{
+    var revisions = this._raw['revisions'];
+    var rawData = revisions[repositoryName];
+    if (!rawData)
+        return null;
+    return new Date(rawData[1]);
+}
+
</ins><span class="cx"> Measurement.prototype.formattedRevisions = function (previousMeasurement)
</span><span class="cx"> {
</span><span class="cx">     var revisions = this._raw['revisions'];
</span><span class="lines">@@ -77,13 +121,8 @@
</span><span class="cx">     var formattedRevisions = {};
</span><span class="cx">     for (var repositoryName in revisions) {
</span><span class="cx">         var currentRevision = revisions[repositoryName][0];
</span><del>-        var commitTimeInPOSIX = revisions[repositoryName][1];
-
</del><span class="cx">         var previousRevision = previousRevisions ? previousRevisions[repositoryName][0] : null;
</span><del>-
</del><span class="cx">         var formatttedRevision = this._formatRevisionRange(previousRevision, currentRevision);
</span><del>-        if (commitTimeInPOSIX)
-            formatttedRevision['commitTime'] = new Date(commitTimeInPOSIX);
</del><span class="cx">         formattedRevisions[repositoryName] = formatttedRevision;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv2indexhtml"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v2/index.html (174710 => 174711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v2/index.html        2014-10-14 23:43:54 UTC (rev 174710)
+++ trunk/Websites/perf.webkit.org/public/v2/index.html        2014-10-14 23:46:45 UTC (rev 174711)
</span><span class="lines">@@ -135,9 +135,12 @@
</span><span class="cx">                     {{metric.label}}
</span><span class="cx">                     - {{ platform.name}}&lt;/h2&gt;
</span><span class="cx">                     &lt;a href=&quot;#&quot; title=&quot;Close&quot; class=&quot;close-button&quot; {{action &quot;close&quot;}}&gt;{{partial &quot;close-button&quot;}}&lt;/a&gt;
</span><ins>+                    {{if App.Manifest.repositoriesWithReportedCommits}}
+                        &lt;a href=&quot;#&quot; title=&quot;Search&quot; class=&quot;search-button&quot; {{action &quot;toggleSearch&quot;}}&gt;{{partial &quot;search-button&quot;}}&lt;/a&gt;
+                    {{/if}}
</ins><span class="cx">                 &lt;/header&gt;
</span><span class="cx"> 
</span><del>-                &lt;div {{bind-attr class=&quot;:body showingDetails&quot;}}&gt;
</del><ins>+                &lt;div class=&quot;body&quot;&gt;
</ins><span class="cx">                     &lt;div class=&quot;svg-container&quot;&gt;
</span><span class="cx">                     {{#if chartData}}
</span><span class="cx">                         {{interactive-chart
</span><span class="lines">@@ -147,6 +150,7 @@
</span><span class="cx">                             currentItem=currentItem
</span><span class="cx">                             currentTime=sharedTime
</span><span class="cx">                             selectedItem=selectedItem
</span><ins>+                            highlightedItems=highlightedItems
</ins><span class="cx">                             selection=timeRange
</span><span class="cx">                             sharedSelection=sharedSelection
</span><span class="cx">                             selectionChanged=&quot;rangeChanged&quot;
</span><span class="lines">@@ -177,6 +181,16 @@
</span><span class="cx">                         {{/if}}
</span><span class="cx">                     &lt;/div&gt;
</span><span class="cx">                 &lt;/div&gt;
</span><ins>+
+                &lt;form {{bind-attr class=&quot;:search-pane showingSearchPane::hidden&quot;}}&gt;
+                    &lt;span class=&quot;repositories&quot;&gt;
+                        {{view Ember.Select content=App.Manifest.repositoriesWithReportedCommits
+                            optionLabelPath='content.id'
+                            selection=commitSearchRepository}}
+                    &lt;/span&gt;
+                    {{input action=&quot;searchCommit&quot; placeholder=&quot;Name or email&quot; value=commitSearchKeyword}}
+                &lt;/form&gt;
+
</ins><span class="cx">             &lt;/section&gt;
</span><span class="cx">         {{/each}}
</span><span class="cx">     &lt;/script&gt;
</span><span class="lines">@@ -258,7 +272,7 @@
</span><span class="cx">     &lt;/script&gt;
</span><span class="cx"> 
</span><span class="cx">     &lt;script type=&quot;text/x-handlebars&quot; data-template-name=&quot;close-button&quot;&gt;
</span><del>-        &lt;svg class=&quot;close-button&quot; viewBox=&quot;0 0 100 100&quot;&gt;
</del><ins>+        &lt;svg class=&quot;close-button icon-button&quot; viewBox=&quot;0 0 100 100&quot;&gt;
</ins><span class="cx">             &lt;g stroke=&quot;black&quot; stroke-width=&quot;10&quot;&gt;
</span><span class="cx">                 &lt;circle cx=&quot;50&quot; cy=&quot;50&quot; r=&quot;45&quot; fill=&quot;transparent&quot;/&gt;
</span><span class="cx">                 &lt;polygon points=&quot;30,30 70,70&quot; /&gt;
</span><span class="lines">@@ -267,6 +281,15 @@
</span><span class="cx">         &lt;/svg&gt;
</span><span class="cx">     &lt;/script&gt;
</span><span class="cx"> 
</span><ins>+    &lt;script type=&quot;text/x-handlebars&quot; data-template-name=&quot;search-button&quot;&gt;
+        &lt;svg class=&quot;search-button icon-button&quot; viewBox=&quot;0 0 100 100&quot;&gt;
+            &lt;g stroke=&quot;black&quot; stroke-width=&quot;15&quot;&gt;
+                &lt;circle cx=&quot;60&quot; cy=&quot;40&quot; r=&quot;30&quot; fill=&quot;transparent&quot;/&gt;
+                &lt;line x1=&quot;10&quot; y1=&quot;90&quot; x2=&quot;40&quot; y2=&quot;60&quot;/&gt;
+            &lt;/g&gt;
+        &lt;/svg&gt;
+    &lt;/script&gt;
+
</ins><span class="cx">     &lt;script type=&quot;text/x-handlebars&quot; data-template-name=&quot;spinner&quot;&gt;
</span><span class="cx">         &lt;svg class=&quot;spinner&quot; viewBox=&quot;0 0 100 100&quot;&gt;
</span><span class="cx">             &lt;line x1=&quot;10&quot; y1=&quot;50&quot; x2=&quot;30&quot; y2=&quot;50&quot; stroke=&quot;black&quot; stroke-width=&quot;10&quot; stroke-linecap=&quot;round&quot;/&gt;
</span></span></pre></div>
<a id="trunkWebsitesperfwebkitorgpublicv2manifestjs"></a>
<div class="modfile"><h4>Modified: trunk/Websites/perf.webkit.org/public/v2/manifest.js (174710 => 174711)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Websites/perf.webkit.org/public/v2/manifest.js        2014-10-14 23:43:54 UTC (rev 174710)
+++ trunk/Websites/perf.webkit.org/public/v2/manifest.js        2014-10-14 23:46:45 UTC (rev 174711)
</span><span class="lines">@@ -147,6 +147,8 @@
</span><span class="cx">     _platformById: {},
</span><span class="cx">     _metricById: {},
</span><span class="cx">     _builderById: {},
</span><ins>+    repositories: null,
+    repositoriesWithReportedCommits: null,
</ins><span class="cx">     _repositoryById: {},
</span><span class="cx">     _fetchPromise: null,
</span><span class="cx">     fetch: function ()
</span><span class="lines">@@ -190,8 +192,12 @@
</span><span class="cx">             self._builderById[builder.get('id')] = builder;
</span><span class="cx">         });
</span><span class="cx"> 
</span><del>-        store.all('repository').forEach(function (repository) {
</del><ins>+        var repositories = store.all('repository');
+        repositories.forEach(function (repository) {
</ins><span class="cx">             self._repositoryById[repository.get('id')] = repository;
</span><span class="cx">         });
</span><ins>+        this.set('repositories', repositories);
+        this.set('repositoriesWithReportedCommits',
+            repositories.filter(function (repository) { return repository.get('hasReportedCommits'); }));
</ins><span class="cx">     }
</span><span class="cx"> }).create();
</span></span></pre>
</div>
</div>

</body>
</html>