1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 05:12:41 +01:00

Don't load every commit if there are no local hashes

Summary: We make a silly query for every commit if you copy/paste a diff.

Test Plan: Copy/pasted diffs now render in fewer than 30 seconds.

Reviewers: btrahan, spicyj

Reviewed By: btrahan, spicyj

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D8758
This commit is contained in:
epriestley 2014-04-10 18:09:54 -07:00
parent e7419d85f7
commit 650bc97ed7

View file

@ -193,11 +193,18 @@ final class DifferentialRevisionViewController extends DifferentialController {
$commit_hashes[] = idx($local_commit, 'local');
}
$commit_hashes = array_unique(array_filter($commit_hashes));
$commits_for_links = id(new DiffusionCommitQuery())
->setViewer($user)
->withIdentifiers($commit_hashes)
->execute();
$commits_for_links = mpull($commits_for_links, null, 'getCommitIdentifier');
if ($commit_hashes) {
$commits_for_links = id(new DiffusionCommitQuery())
->setViewer($user)
->withIdentifiers($commit_hashes)
->execute();
$commits_for_links = mpull(
$commits_for_links,
null,
'getCommitIdentifier');
} else {
$commit_for_links = array();
}
$revision_detail = id(new DifferentialRevisionDetailView())
->setUser($user)