WebKit Bugzilla
Attachment 372941 Details for
Bug 199227
: commit api should not return 'AmbiguousRevisionPrefix' if there is an exact revision match
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199227-20190626125715.patch (text/plain), 4.73 KB, created by
dewei_zhu
on 2019-06-26 12:57:16 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
dewei_zhu
Created:
2019-06-26 12:57:16 PDT
Size:
4.73 KB
patch
obsolete
>Subversion Revision: 246846 >diff --git a/Websites/perf.webkit.org/ChangeLog b/Websites/perf.webkit.org/ChangeLog >index ace89f225e46361dc06586c03713177487c217b6..6be876bb44994d907a31ce93e004e7401ab639f3 100644 >--- a/Websites/perf.webkit.org/ChangeLog >+++ b/Websites/perf.webkit.org/ChangeLog >@@ -1,3 +1,16 @@ >+2019-06-26 Dewei Zhu <dewei_zhu@apple.com> >+ >+ commit api should not return 'AmbiguousRevisionPrefix' if there is an exact revision match >+ https://bugs.webkit.org/show_bug.cgi?id=199227 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ When prefix match is specified, api should check whether there is an exact match when multiple commits >+ match the prefix. >+ >+ * public/include/commit-log-fetcher.php: Added the logic to check if there is an exact match when multiple matches are found. >+ * server-tests/api-commits-tests.js: Added an unit test. >+ > 2019-06-24 Dean Johnson <dean_johnson@apple.com> > > [perf.webkit.org] Update summary page calculations to use mean instead of median >diff --git a/Websites/perf.webkit.org/public/include/commit-log-fetcher.php b/Websites/perf.webkit.org/public/include/commit-log-fetcher.php >index 0fd6df82d41a359c5e72455958e1e07ce82881be..6e0becd0bc8164c042fd3fb2f3998c4154feb0e1 100644 >--- a/Websites/perf.webkit.org/public/include/commit-log-fetcher.php >+++ b/Websites/perf.webkit.org/public/include/commit-log-fetcher.php >@@ -201,11 +201,14 @@ class CommitLogFetcher { > } > > private function commit_for_revision_prefix($repository_id, $revision_prefix) { >- $rows = $this->db->query_and_fetch_all('SELECT * FROM commits WHERE commit_repository = $1 AND commit_revision LIKE $2 LIMIT 2', array($repository_id, Database::escape_for_like($revision_prefix) . '%')); >+ $rows = $this->db->query_and_fetch_all('SELECT * FROM commits WHERE commit_repository = $1 AND commit_revision LIKE $2 ORDER BY commit_revision LIMIT 2', array($repository_id, Database::escape_for_like($revision_prefix) . '%')); > if (count($rows) == 0) > exit_with_error('UnknownCommit', array('repository' => $repository_id, 'revision' => $revision_prefix)); >- if (count($rows) == 2) >+ if (count($rows) == 2) { >+ if ($rows[0]['commit_revision'] == $revision_prefix) >+ return $rows[0]; > exit_with_error('AmbiguousRevisionPrefix', array('repository' => $repository_id, 'revision' => $revision_prefix)); >+ } > return $rows[0]; > } > >diff --git a/Websites/perf.webkit.org/server-tests/api-commits-tests.js b/Websites/perf.webkit.org/server-tests/api-commits-tests.js >index 8bdade216b5b95fe01ee515b85916f3515b16549..4344589f21f7c0c688a8707f6097d960996b71c1 100644 >--- a/Websites/perf.webkit.org/server-tests/api-commits-tests.js >+++ b/Websites/perf.webkit.org/server-tests/api-commits-tests.js >@@ -39,6 +39,27 @@ describe("/api/commits/", function () { > ] > } > >+ const commitsOnePrefixOfTheOther = { >+ "slaveName": "someSlave", >+ "slavePassword": "somePassword", >+ "commits": [ >+ { >+ "repository": "WebKit", >+ "revision": "21094", >+ "time": "2017-01-20T02:52:34.577Z", >+ "author": {"name": "Zalan Bujtas", "account": "zalan@apple.com"}, >+ "message": "a message", >+ }, >+ { >+ "repository": "WebKit", >+ "revision": "210949", >+ "time": "2017-01-20T03:23:50.645Z", >+ "author": {"name": "Chris Dumez", "account": "cdumez@apple.com"}, >+ "message": "some message", >+ } >+ ] >+ } >+ > const systemVersionCommits = { > "slaveName": "someSlave", > "slavePassword": "somePassword", >@@ -460,6 +481,16 @@ describe("/api/commits/", function () { > assert.equal(result['status'], 'AmbiguousRevisionPrefix'); > }); > >+ it("should not return 'AmbiguousRevisionPrefix' when there is a commit revision extract matches specified revision prefix", async () => { >+ const remote = TestServer.remoteAPI(); >+ await addSlaveForReport(commitsOnePrefixOfTheOther); >+ await remote.postJSONWithStatus('/api/report-commits/', commitsOnePrefixOfTheOther); >+ const result = await remote.getJSON('/api/commits/WebKit/21094?prefix-match=true'); >+ assert.equal(result['status'], 'OK'); >+ assert.deepEqual(result['commits'].length, 1); >+ assertCommitIsSameAsOneSubmitted(result['commits'][0], commitsOnePrefixOfTheOther['commits'][0]); >+ }); >+ > it("should return 'UnknownCommit' when no commit is found for a revision prefix", async () => { > const remote = TestServer.remoteAPI(); > await addSlaveForReport(subversionCommits);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
rniwa
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199227
: 372941