When a revision is accepted but has open dependencies, show a note in the list UI

Summary:
Ref T10939. I don't think this is hugely important, but it doesn't clutter things up much and it's nice as a hint.

T4055 was the original request specifically asking for this. It wanted a separate bucket, but I think this use case isn't common/strong enough to justify that.

I would like to improve Differential's "X depends on Y" feature in the long term. We don't tend to use/need it much, but it could easily do a better and more automatic job of supporting review of a group of revisions.

Test Plan: {F1426636}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10939

Differential Revision: https://secure.phabricator.com/D15930
This commit is contained in:
epriestley
2016-05-16 11:53:29 -07:00
parent c5853b4f48
commit bf5437212c
2 changed files with 75 additions and 0 deletions

View File

@@ -153,6 +153,8 @@ final class DifferentialRevisionSearchEngine
$bucket = $this->getResultBucket($query);
$unlanded = $this->loadUnlandedDependencies($revisions);
$views = array();
if ($bucket) {
$bucket->setViewer($viewer);
@@ -187,6 +189,7 @@ final class DifferentialRevisionSearchEngine
foreach ($views as $view) {
$view->setHandles($handles);
$view->setUnlandedDependencies($unlanded);
}
if (count($views) == 1) {
@@ -223,4 +226,56 @@ final class DifferentialRevisionSearchEngine
return $view;
}
private function loadUnlandedDependencies(array $revisions) {
$status_accepted = ArcanistDifferentialRevisionStatus::ACCEPTED;
$phids = array();
foreach ($revisions as $revision) {
if ($revision->getStatus() != $status_accepted) {
continue;
}
$phids[] = $revision->getPHID();
}
if (!$phids) {
return array();
}
$query = id(new PhabricatorEdgeQuery())
->withSourcePHIDs($phids)
->withEdgeTypes(
array(
DifferentialRevisionDependsOnRevisionEdgeType::EDGECONST,
));
$query->execute();
$revision_phids = $query->getDestinationPHIDs();
if (!$revision_phids) {
return array();
}
$viewer = $this->requireViewer();
$blocking_revisions = id(new DifferentialRevisionQuery())
->setViewer($viewer)
->withPHIDs($revision_phids)
->withStatus(DifferentialRevisionQuery::STATUS_OPEN)
->execute();
$blocking_revisions = mpull($blocking_revisions, null, 'getPHID');
$result = array();
foreach ($revisions as $revision) {
$revision_phid = $revision->getPHID();
$blocking_phids = $query->getDestinationPHIDs(array($revision_phid));
$blocking = array_select_keys($blocking_revisions, $blocking_phids);
if ($blocking) {
$result[$revision_phid] = $blocking;
}
}
return $result;
}
}