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 = ($drequest->getPath() === null
54 ||
!strlen($drequest->getPath()));
57 ->setParents($history_results['parents'])
58 ->setIsHead(!$pager->getOffset())
59 ->setIsTail(!$pager->getHasMorePages());
62 $header = $this->buildHeader($drequest);
64 $crumbs = $this->buildCrumbs(
70 $crumbs->setBorder(true);
74 $repository->getDisplayName(),
77 $pager = id(new PHUIBoxView())
79 ->appendChild($pager);
81 $tabs = $this->buildTabsView('history');
83 $view = id(new PHUITwoColumnView())
91 return $this->newPage()
95 ->addClass('diffusion-history-view');
98 private function buildHeader(DiffusionRequest
$drequest) {
99 $viewer = $this->getViewer();
100 $repository = $drequest->getRepository();
102 $no_path = $drequest->getPath() === null ||
!strlen($drequest->getPath());
104 $header_text = pht('History');
106 $header_text = $this->renderPathLinks($drequest, $mode = 'history');
109 $header = id(new PHUIHeaderView())
111 ->setHeader($header_text)
112 ->setHeaderIcon('fa-clock-o');
114 if (!$repository->isSVN()) {
115 $branch_tag = $this->renderBranchTag($drequest);
116 $header->addTag($branch_tag);
119 if ($drequest->getSymbolicCommit()) {
120 $symbolic_tag = $this->renderSymbolicCommit($drequest);
121 $header->addTag($symbolic_tag);