3 final class DiffusionHistoryController
extends DiffusionController
{
5 public function shouldAllowPublic() {
9 public function handleRequest(AphrontRequest
$request) {
10 $response = $this->loadDiffusionContext();
14 require_celerity_resource('diffusion-css');
16 $viewer = $this->getViewer();
17 $drequest = $this->getDiffusionRequest();
18 $repository = $drequest->getRepository();
20 $pager = id(new PHUIPagerView())
21 ->readFromRequest($request);
24 'commit' => $drequest->getCommit(),
25 'path' => $drequest->getPath(),
26 'offset' => $pager->getOffset(),
27 'limit' => $pager->getPageSize() +
1,
30 $history_results = $this->callConduitWithDiffusionRequest(
31 'diffusion.historyquery',
33 $history = DiffusionPathChange
::newFromConduit(
34 $history_results['pathChanges']);
36 $history = $pager->sliceResults($history);
38 $history_list = id(new DiffusionCommitGraphView())
40 ->setDiffusionRequest($drequest)
41 ->setHistory($history);
43 // NOTE: If we have a path (like "src/"), many nodes in the graph are
44 // likely to be missing (since the path wasn't touched by those commits).
46 // If we draw the graph, commits will often appear to be unrelated because
47 // intermediate nodes are omitted. Just drop the graph.
49 // The ideal behavior would be to load the entire graph and then connect
50 // ancestors appropriately, but this would currrently be prohibitively
51 // expensive in the general case.
53 $show_graph = !strlen($drequest->getPath());
56 ->setParents($history_results['parents'])
57 ->setIsHead(!$pager->getOffset())
58 ->setIsTail(!$pager->getHasMorePages());
61 $header = $this->buildHeader($drequest);
63 $crumbs = $this->buildCrumbs(
69 $crumbs->setBorder(true);
73 $repository->getDisplayName(),
76 $pager = id(new PHUIBoxView())
78 ->appendChild($pager);
80 $tabs = $this->buildTabsView('history');
82 $view = id(new PHUITwoColumnView())
90 return $this->newPage()
94 ->addClass('diffusion-history-view');
97 private function buildHeader(DiffusionRequest
$drequest) {
98 $viewer = $this->getViewer();
99 $repository = $drequest->getRepository();
101 $no_path = !strlen($drequest->getPath());
103 $header_text = pht('History');
105 $header_text = $this->renderPathLinks($drequest, $mode = 'history');
108 $header = id(new PHUIHeaderView())
110 ->setHeader($header_text)
111 ->setHeaderIcon('fa-clock-o');
113 if (!$repository->isSVN()) {
114 $branch_tag = $this->renderBranchTag($drequest);
115 $header->addTag($branch_tag);
118 if ($drequest->getSymbolicCommit()) {
119 $symbolic_tag = $this->renderSymbolicCommit($drequest);
120 $header->addTag($symbolic_tag);