diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php index 192b1000e2..37b6cb8045 100644 --- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php +++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php @@ -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(); diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryGitCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryGitCommitMessageParserWorker.php index 15bd3a01b0..b41f4c421c 100644 --- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryGitCommitMessageParserWorker.php +++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryGitCommitMessageParserWorker.php @@ -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); diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryMercurialCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryMercurialCommitMessageParserWorker.php index 0a514955f6..72d187d896 100644 --- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryMercurialCommitMessageParserWorker.php +++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryMercurialCommitMessageParserWorker.php @@ -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); diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositorySvnCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositorySvnCommitMessageParserWorker.php index 57a222190b..648c8adaaf 100644 --- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositorySvnCommitMessageParserWorker.php +++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositorySvnCommitMessageParserWorker.php @@ -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);