3 final class DiffusionChangeController
extends DiffusionController
{
5 public function shouldAllowPublic() {
9 public function handleRequest(AphrontRequest
$request) {
10 $response = $this->loadDiffusionContext();
15 $viewer = $this->getViewer();
16 $drequest = $this->getDiffusionRequest();
18 $data = $this->callConduitWithDiffusionRequest(
19 'diffusion.diffquery',
21 'commit' => $drequest->getCommit(),
22 'path' => $drequest->getPath(),
25 $drequest->updateSymbolicCommit($data['effectiveCommit']);
27 $raw_changes = ArcanistDiffChange
::newFromConduit($data['changes']);
28 $diff = DifferentialDiff
::newEphemeralFromRawChanges(
30 $changesets = $diff->getChangesets();
31 $changeset = reset($changesets);
35 return new Aphront404Response();
38 $repository = $drequest->getRepository();
43 $changeset_header = $this->buildChangesetHeader($drequest);
45 $changeset_view = new DifferentialChangesetListView();
46 $changeset_view->setChangesets($changesets);
47 $changeset_view->setBackground(PHUIObjectBoxView
::BLUE_PROPERTY
);
48 $changeset_view->setVisibleChangesets($changesets);
49 $changeset_view->setRenderingReferences(
51 0 => $drequest->generateURI(array('action' => 'rendering-ref')),
61 $right_uri = $drequest->generateURI($raw_params);
62 $raw_params['params']['before'] = $drequest->getStableCommit();
63 $left_uri = $drequest->generateURI($raw_params);
64 $changeset_view->setRawFileURIs($left_uri, $right_uri);
66 $changeset_view->setRenderURI($repository->getPathURI('diff/'));
67 $changeset_view->setUser($viewer);
68 $changeset_view->setHeader($changeset_header);
70 // TODO: This is pretty awkward, unify the CSS between Diffusion and
71 // Differential better.
72 require_celerity_resource('differential-core-view-css');
74 $crumbs = $this->buildCrumbs(
80 $crumbs->setBorder(true);
82 $links = $this->renderPathLinks($drequest, $mode = 'browse');
83 $header = $this->buildHeader($drequest, $links);
85 $view = id(new PHUITwoColumnView())
87 ->setMainColumn(array(
93 return $this->newPage()
96 basename($drequest->getPath()),
97 $repository->getDisplayName(),
106 private function buildHeader(
107 DiffusionRequest
$drequest,
109 $viewer = $this->getViewer();
111 $tag = $this->renderCommitHashTag($drequest);
113 $header = id(new PHUIHeaderView())
116 ->setPolicyObject($drequest->getRepository())
122 private function buildChangesetHeader(DiffusionRequest
$drequest) {
123 $viewer = $this->getViewer();
125 $header = id(new PHUIHeaderView())
126 ->setHeader(pht('Changes'));
128 $history_uri = $drequest->generateURI(
130 'action' => 'history',
133 $header->addActionLink(
134 id(new PHUIButtonView())
136 ->setText(pht('View History'))
137 ->setHref($history_uri)
138 ->setIcon('fa-clock-o'));
140 $browse_uri = $drequest->generateURI(
142 'action' => 'browse',
145 $header->addActionLink(
146 id(new PHUIButtonView())
148 ->setText(pht('Browse Content'))
149 ->setHref($browse_uri)
150 ->setIcon('fa-files-o'));
155 protected function buildPropertyView(
156 DiffusionRequest
$drequest,
157 PhabricatorActionListView
$actions) {
159 $viewer = $this->getRequest()->getUser();
161 $view = id(new PHUIPropertyListView())
163 ->setActionList($actions);
165 $stable_commit = $drequest->getStableCommit();
172 'href' => $drequest->generateURI(
174 'action' => 'commit',
175 'commit' => $stable_commit,
178 $drequest->getRepository()->formatCommitName($stable_commit)));