REGRESSION(r198234): /api/commits/%revision% always fails
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jan 2017 22:02:09 +0000 (22:02 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jan 2017 22:02:09 +0000 (22:02 +0000)
commit2a9636a94e1b1e6e0dcad1958bc1c5e5f4da1196
tree7ddedce8dfad92089dfbd7f4a13eb766bd8d8bbf
parentdc33c412867309f70283b90106d1d3fd061961e8
REGRESSION(r198234): /api/commits/%revision% always fails
https://bugs.webkit.org/show_bug.cgi?id=167235

Reviewed by Antti Koivisto.

The bug was caused by a typo in CommitLogFetcher::fetch_revision, which was calling commit_for_revision on
$this->db instead of $this. This had been monkey-patched in the internal dashboard so it was working there.

Also fixed a bug that /latest wasn't doing what it claimed to do, and a bug that /oldest /latest,
and /last-reported would return a commit with all values set to null instead of an empty list.

Finally, added server API tests for /api/commits.

* public/api/commits.php:
(main): Add a comment for APIs that only exist for v2 UI.

* public/include/commit-log-fetcher.php:
(CommitLogFetcher::fetch_latest): Fixed the bug that this function was returning the oldest commit, not the
the latest commit as desired.
(CommitLogFetcher::fetch_revision): Fixed the bug that this function would always encounter an exception
because commit_for_revision is defined on $this, not $this->db.
(CommitLogFetcher::format_single_commit): Return an empty list instead of an array with a single commit with
all values set to null.

* server-tests/api-commits.js: Added. Added tests for the JSON API at /api/commits.
(.assertCommitIsSameAsOneSubmitted): Added. A helper function to compare a commit returned by /api/commits
to one sent to /api/report-commits.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210981 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Websites/perf.webkit.org/ChangeLog
Websites/perf.webkit.org/public/api/commits.php
Websites/perf.webkit.org/public/include/commit-log-fetcher.php
Websites/perf.webkit.org/server-tests/api-commits.js [new file with mode: 0644]