1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-27 16:00:59 +01:00

Attach TaskPHIDs to commits in diffusion.getcommits

Summary: Uses edge query to attach TaskPHIDs to commit objects

Test Plan: Use conduit to getcommits with attached tasks

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Differential Revision: https://secure.phabricator.com/D7668
This commit is contained in:
John Watson 2013-11-27 14:35:55 -08:00 committed by epriestley
parent d571507651
commit 49f3ff0e08

View file

@ -129,6 +129,7 @@ final class ConduitAPI_diffusion_getcommits_Method
$commits = $this->addRepositoryCommitDataInformation($commits);
$commits = $this->addDifferentialInformation($commits);
$commits = $this->addManiphestInformation($commits);
foreach ($commits as $name => $commit) {
$results[$name] = $commit;
@ -261,4 +262,31 @@ final class ConduitAPI_diffusion_getcommits_Method
return $commits;
}
/**
* Enhances the commits list with Maniphest information.
*/
private function addManiphestInformation(array $commits) {
$task_type = PhabricatorEdgeConfig::TYPE_COMMIT_HAS_TASK;
$commit_phids = ipull($commits, 'commitPHID');
$edge_query = id(new PhabricatorEdgeQuery())
->withSourcePHIDs($commit_phids)
->withEdgeTypes(array($task_type));
$edges = $edge_query->execute();
foreach ($commits as $name => $commit) {
$task_phids = $edge_query->getDestinationPHIDs(
array($commit['commitPHID']),
array($task_type));
$commits[$name] += array(
'taskPHIDs' => $task_phids,
);
}
return $commits;
}
}