Page MenuHomePhabricator

D11253.id28280.diff
No OneTemporary

D11253.id28280.diff

diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
--- 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
--- 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
--- 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
--- 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);

File Metadata

Mime Type
text/plain
Expires
Wed, Apr 2, 4:59 AM (3 d, 13 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7385376
Default Alt Text
D11253.id28280.diff (4 KB)

Event Timeline