diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php index ad01efbe19..4b66aea52c 100644 --- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php @@ -493,10 +493,42 @@ final class ManiphestTaskDetailController extends ManiphestController { => pht('Depends On'), PhabricatorEdgeConfig::TYPE_TASK_HAS_RELATED_DREV => pht('Differential Revisions'), - PhabricatorEdgeConfig::TYPE_TASK_HAS_COMMIT - => pht('Commits'), ); + $revisions_commits = array(); + $handles = $this->getLoadedHandles(); + + $commit_phids = array_keys( + $edges[PhabricatorEdgeConfig::TYPE_TASK_HAS_COMMIT]); + if ($commit_phids) { + $commits = id(new PhabricatorRepositoryCommit()) + ->putInSet(new LiskDAOSet()) + ->loadAllWhere('phid IN (%Ls)', $commit_phids); + + foreach ($commits as $commit) { + $phid = $commit->getPHID(); + $revisions_commits[$phid] = $handles[$phid]->renderLink(); + + $data = $commit->loadOneRelative( + new PhabricatorRepositoryCommitData(), + 'commitID'); + + $revision_phid = ($data + ? $data->getCommitDetail('differential.revisionPHID') + : null); + + $revision_handle = idx($handles, $revision_phid); + if ($revision_handle) { + $has_drev = PhabricatorEdgeConfig::TYPE_TASK_HAS_RELATED_DREV; + unset($edges[$has_drev][$revision_phid]); + $revisions_commits[$phid] = hsprintf( + '%s / %s', + $revision_handle->renderLink($revision_handle->getName()), + $revisions_commits[$phid]); + } + } + } + foreach ($edge_types as $edge_type => $edge_name) { if ($edges[$edge_type]) { $view->addProperty( @@ -505,6 +537,12 @@ final class ManiphestTaskDetailController extends ManiphestController { } } + if ($revisions_commits) { + $view->addProperty( + pht('Commits'), + phutil_implode_html(phutil_tag('br'), $revisions_commits)); + } + $attached = $task->getAttached(); $file_infos = idx($attached, PhabricatorPHIDConstants::PHID_TYPE_FILE); if ($file_infos) { diff --git a/src/applications/phid/PhabricatorObjectHandle.php b/src/applications/phid/PhabricatorObjectHandle.php index 1ded1abc27..c8673a5be0 100644 --- a/src/applications/phid/PhabricatorObjectHandle.php +++ b/src/applications/phid/PhabricatorObjectHandle.php @@ -166,8 +166,10 @@ final class PhabricatorObjectHandle { } - public function renderLink() { - $name = $this->getLinkName(); + public function renderLink($name = null) { + if ($name === null) { + $name = $this->getLinkName(); + } $class = null; $title = null;