Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/controller/DiffusionHistoryController.php
| Show All 29 Lines | public function handleRequest(AphrontRequest $request) { | ||||
| $history_results = $this->callConduitWithDiffusionRequest( | $history_results = $this->callConduitWithDiffusionRequest( | ||||
| 'diffusion.historyquery', | 'diffusion.historyquery', | ||||
| $params); | $params); | ||||
| $history = DiffusionPathChange::newFromConduit( | $history = DiffusionPathChange::newFromConduit( | ||||
| $history_results['pathChanges']); | $history_results['pathChanges']); | ||||
| $history = $pager->sliceResults($history); | $history = $pager->sliceResults($history); | ||||
| $identifiers = array(); | |||||
| foreach ($history as $item) { | |||||
| $identifiers[] = $item->getCommitIdentifier(); | |||||
| } | |||||
| if ($identifiers) { | |||||
| $commits = id(new DiffusionCommitQuery()) | |||||
| ->setViewer($viewer) | |||||
| ->withRepositoryPHIDs(array($repository->getPHID())) | |||||
| ->withIdentifiers($identifiers) | |||||
| ->needCommitData(true) | |||||
| ->needIdentities(true) | |||||
| ->execute(); | |||||
| } else { | |||||
| $commits = array(); | |||||
| } | |||||
| $history_list = id(new DiffusionCommitGraphView()) | $history_list = id(new DiffusionCommitGraphView()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->setDiffusionRequest($drequest) | ->setDiffusionRequest($drequest) | ||||
| ->setHistory($history) | ->setHistory($history); | ||||
| ->setCommits($commits); | |||||
| // NOTE: If we have a path (like "src/"), many nodes in the graph are | // NOTE: If we have a path (like "src/"), many nodes in the graph are | ||||
| // likely to be missing (since the path wasn't touched by those commits). | // likely to be missing (since the path wasn't touched by those commits). | ||||
| // If we draw the graph, commits will often appear to be unrelated because | // If we draw the graph, commits will often appear to be unrelated because | ||||
| // intermediate nodes are omitted. Just drop the graph. | // intermediate nodes are omitted. Just drop the graph. | ||||
| // The ideal behavior would be to load the entire graph and then connect | // The ideal behavior would be to load the entire graph and then connect | ||||
| ▲ Show 20 Lines • Show All 78 Lines • Show Last 20 Lines | |||||