Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/query/DifferentialDiffQuery.php
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | foreach ($diffs as $key => $diff) { | ||||
$diff->attachRevision($revision); | $diff->attachRevision($revision); | ||||
continue; | continue; | ||||
} | } | ||||
unset($diffs[$key]); | unset($diffs[$key]); | ||||
} | } | ||||
if ($this->needChangesets) { | if ($diffs && $this->needChangesets) { | ||||
$this->loadChangesets($diffs); | $diffs = $this->loadChangesets($diffs); | ||||
} | } | ||||
if ($this->needArcanistProjects) { | if ($diffs && $this->needArcanistProjects) { | ||||
$this->loadArcanistProjects($diffs); | $diffs = $this->loadArcanistProjects($diffs); | ||||
} | } | ||||
return $diffs; | return $diffs; | ||||
} | } | ||||
private function loadChangesets(array $diffs) { | private function loadChangesets(array $diffs) { | ||||
foreach ($diffs as $diff) { | $diff_ids = mpull($diffs, 'getID'); | ||||
$diff->attachChangesets( | |||||
$diff->loadRelatives(new DifferentialChangeset(), 'diffID')); | $changesets = id(new DifferentialChangeset())->loadAllWhere( | ||||
foreach ($diff->getChangesets() as $changeset) { | 'diffID IN (%Ld)', | ||||
$changeset->attachHunks( | $diff_ids); | ||||
$changeset->loadRelatives(new DifferentialHunk(), 'changesetID')); | |||||
if ($changesets) { | |||||
id(new DifferentialHunkQuery()) | |||||
->setViewer($this->getViewer()) | |||||
->setParentQuery($this) | |||||
->withChangesets($changesets) | |||||
->needAttachToChangesets(true) | |||||
->execute(); | |||||
} | } | ||||
$changeset_groups = mgroup($changesets, 'getDiffID'); | |||||
foreach ($diffs as $diff) { | |||||
$diff_changesets = idx($changeset_groups, $diff->getID(), array()); | |||||
$diff->attachChangesets($diff_changesets); | |||||
} | } | ||||
return $diffs; | return $diffs; | ||||
} | } | ||||
private function loadArcanistProjects(array $diffs) { | private function loadArcanistProjects(array $diffs) { | ||||
$phids = array_filter(mpull($diffs, 'getArcanistProjectPHID')); | $phids = array_filter(mpull($diffs, 'getArcanistProjectPHID')); | ||||
$projects = array(); | $projects = array(); | ||||
$project_map = array(); | $project_map = array(); | ||||
if ($phids) { | if ($phids) { | ||||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |