mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Remove direct calls to LowLevelCommitQuery
Summary: Ref T2783. This cleans up some more of the direct VCS access calls. If the repository is local, this boils down to an in-process call. If not, it uses Conduit to make an intracluster request. Test Plan: Used `reparse.php --message <commit> --trace` to observe cluster request. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T2783 Differential Revision: https://secure.phabricator.com/D11253
This commit is contained in:
parent
a7814b071c
commit
bdd7a35b30
4 changed files with 44 additions and 21 deletions
|
@ -3,6 +3,41 @@
|
|||
abstract class PhabricatorRepositoryCommitMessageParserWorker
|
||||
extends PhabricatorRepositoryCommitParserWorker {
|
||||
|
||||
abstract protected function parseCommitWithRef(
|
||||
PhabricatorRepository $repository,
|
||||
PhabricatorRepositoryCommit $commit,
|
||||
DiffusionCommitRef $ref);
|
||||
|
||||
final protected function parseCommit(
|
||||
PhabricatorRepository $repository,
|
||||
PhabricatorRepositoryCommit $commit) {
|
||||
|
||||
$viewer = PhabricatorUser::getOmnipotentUser();
|
||||
|
||||
$refs_raw = DiffusionQuery::callConduitWithDiffusionRequest(
|
||||
$viewer,
|
||||
DiffusionRequest::newFromDictionary(
|
||||
array(
|
||||
'repository' => $repository,
|
||||
'user' => $viewer,
|
||||
)),
|
||||
'diffusion.querycommits',
|
||||
array(
|
||||
'phids' => array($commit->getPHID()),
|
||||
'bypassCache' => true,
|
||||
'needMessages' => true,
|
||||
));
|
||||
|
||||
if (empty($refs_raw['data'])) {
|
||||
throw new Exception(
|
||||
pht('Unable to retrieve details for commit "%s"!'));
|
||||
}
|
||||
|
||||
$ref = DiffusionCommitRef::newFromConduitResult(head($refs_raw['data']));
|
||||
|
||||
$this->parseCommitWithRef($repository, $commit, $ref);
|
||||
}
|
||||
|
||||
final protected function updateCommitData(DiffusionCommitRef $ref) {
|
||||
$commit = $this->commit;
|
||||
$author = $ref->getAuthor();
|
||||
|
|
|
@ -3,14 +3,10 @@
|
|||
final class PhabricatorRepositoryGitCommitMessageParserWorker
|
||||
extends PhabricatorRepositoryCommitMessageParserWorker {
|
||||
|
||||
protected function parseCommit(
|
||||
protected function parseCommitWithRef(
|
||||
PhabricatorRepository $repository,
|
||||
PhabricatorRepositoryCommit $commit) {
|
||||
|
||||
$ref = id(new DiffusionLowLevelCommitQuery())
|
||||
->setRepository($repository)
|
||||
->withIdentifier($commit->getCommitIdentifier())
|
||||
->execute();
|
||||
PhabricatorRepositoryCommit $commit,
|
||||
DiffusionCommitRef $ref) {
|
||||
|
||||
$this->updateCommitData($ref);
|
||||
|
||||
|
|
|
@ -3,14 +3,10 @@
|
|||
final class PhabricatorRepositoryMercurialCommitMessageParserWorker
|
||||
extends PhabricatorRepositoryCommitMessageParserWorker {
|
||||
|
||||
protected function parseCommit(
|
||||
protected function parseCommitWithRef(
|
||||
PhabricatorRepository $repository,
|
||||
PhabricatorRepositoryCommit $commit) {
|
||||
|
||||
$ref = id(new DiffusionLowLevelCommitQuery())
|
||||
->setRepository($repository)
|
||||
->withIdentifier($commit->getCommitIdentifier())
|
||||
->execute();
|
||||
PhabricatorRepositoryCommit $commit,
|
||||
DiffusionCommitRef $ref) {
|
||||
|
||||
$this->updateCommitData($ref);
|
||||
|
||||
|
|
|
@ -3,14 +3,10 @@
|
|||
final class PhabricatorRepositorySvnCommitMessageParserWorker
|
||||
extends PhabricatorRepositoryCommitMessageParserWorker {
|
||||
|
||||
protected function parseCommit(
|
||||
protected function parseCommitWithRef(
|
||||
PhabricatorRepository $repository,
|
||||
PhabricatorRepositoryCommit $commit) {
|
||||
|
||||
$ref = id(new DiffusionLowLevelCommitQuery())
|
||||
->setRepository($repository)
|
||||
->withIdentifier($commit->getCommitIdentifier())
|
||||
->execute();
|
||||
PhabricatorRepositoryCommit $commit,
|
||||
DiffusionCommitRef $ref) {
|
||||
|
||||
$this->updateCommitData($ref);
|
||||
|
||||
|
|
Loading…
Reference in a new issue