Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/controller/DiffusionBlameController.php
Show All 30 Lines | if ($identifiers) { | ||||
->execute(); | ->execute(); | ||||
$commits = mpull($commits, null, 'getCommitIdentifier'); | $commits = mpull($commits, null, 'getCommitIdentifier'); | ||||
} else { | } else { | ||||
$commits = array(); | $commits = array(); | ||||
} | } | ||||
$commit_map = mpull($commits, 'getCommitIdentifier', 'getPHID'); | $commit_map = mpull($commits, 'getCommitIdentifier', 'getPHID'); | ||||
$revision_map = $this->loadRevisionsForCommits($commits); | $revision_map = DiffusionCommitRevisionQuery::loadRevisionMapForCommits( | ||||
$viewer, | |||||
$commits); | |||||
$base_href = (string)$drequest->generateURI( | $base_href = (string)$drequest->generateURI( | ||||
array( | array( | ||||
'action' => 'browse', | 'action' => 'browse', | ||||
'stable' => true, | 'stable' => true, | ||||
)); | )); | ||||
$skip_text = pht('Skip Past This Commit'); | $skip_text = pht('Skip Past This Commit'); | ||||
▲ Show 20 Lines • Show All 214 Lines • ▼ Show 20 Lines | private function renderCommitTooltip( | ||||
if ($author_name) { | if ($author_name) { | ||||
return "{$summary}\n{$date} \xC2\xB7 {$author_name}"; | return "{$summary}\n{$date} \xC2\xB7 {$author_name}"; | ||||
} else { | } else { | ||||
return "{$summary}\n{$date}"; | return "{$summary}\n{$date}"; | ||||
} | } | ||||
} | } | ||||
private function loadRevisionsForCommits(array $commits) { | |||||
if (!$commits) { | |||||
return array(); | |||||
} | |||||
$commit_phids = mpull($commits, 'getPHID'); | |||||
$edge_query = id(new PhabricatorEdgeQuery()) | |||||
->withSourcePHIDs($commit_phids) | |||||
->withEdgeTypes( | |||||
array( | |||||
DiffusionCommitHasRevisionEdgeType::EDGECONST, | |||||
)); | |||||
$edge_query->execute(); | |||||
$revision_phids = $edge_query->getDestinationPHIDs(); | |||||
if (!$revision_phids) { | |||||
return array(); | |||||
} | |||||
$viewer = $this->getViewer(); | |||||
$revisions = id(new DifferentialRevisionQuery()) | |||||
->setViewer($viewer) | |||||
->withPHIDs($revision_phids) | |||||
->execute(); | |||||
$revisions = mpull($revisions, null, 'getPHID'); | |||||
$map = array(); | |||||
foreach ($commit_phids as $commit_phid) { | |||||
$revision_phids = $edge_query->getDestinationPHIDs( | |||||
array( | |||||
$commit_phid, | |||||
)); | |||||
$map[$commit_phid] = array_select_keys($revisions, $revision_phids); | |||||
} | |||||
return $map; | |||||
} | |||||
} | } |