3 final class DiffusionPushEventViewController
4 extends DiffusionLogController
{
6 public function handleRequest(AphrontRequest
$request) {
7 $viewer = $this->getViewer();
9 $event = id(new PhabricatorRepositoryPushEventQuery())
11 ->withIDs(array($request->getURIData('id')))
15 return new Aphront404Response();
18 $repository = $event->getRepository();
19 $title = pht('Push %d', $event->getID());
21 $crumbs = $this->buildApplicationCrumbs();
22 $crumbs->addTextCrumb(
23 $repository->getName(),
24 $repository->getURI());
26 $crumbs->addTextCrumb(
28 $this->getApplicationURI(
29 'pushlog/?repositories='.$repository->getMonogram()));
30 $crumbs->addTextCrumb($title);
32 $event_properties = $this->buildPropertyList($event);
34 $detail_box = id(new PHUIObjectBoxView())
35 ->setHeaderText($title)
36 ->addPropertyList($event_properties);
38 $commits = $this->loadCommits($event);
39 $commits_table = $this->renderCommitsTable($event, $commits);
41 $commits_box = id(new PHUIObjectBoxView())
42 ->setHeaderText(pht('Pushed Commits'))
43 ->setTable($commits_table);
45 $logs = $event->getLogs();
47 $updates_table = id(new DiffusionPushLogListView())
51 $update_box = id(new PHUIObjectBoxView())
52 ->setHeaderText(pht('All Pushed Updates'))
53 ->setTable($updates_table);
55 return $this->newPage()
66 private function buildPropertyList(PhabricatorRepositoryPushEvent
$event) {
67 $viewer = $this->getRequest()->getUser();
68 $view = new PHUIPropertyListView();
72 phabricator_datetime($event->getEpoch(), $viewer));
76 $viewer->renderHandle($event->getPusherPHID()));
80 $event->getRemoteProtocol());
85 private function loadCommits(PhabricatorRepositoryPushEvent
$event) {
86 $viewer = $this->getRequest()->getUser();
88 $identifiers = array();
89 foreach ($event->getLogs() as $log) {
90 if ($log->getRefType() == PhabricatorRepositoryPushLog
::REFTYPE_COMMIT
) {
91 $identifiers[] = $log->getRefNew();
99 // NOTE: Commits may not have been parsed/discovered yet. We need to return
100 // the identifiers no matter what. If possible, we'll also return the
101 // corresponding commits.
103 $commits = id(new DiffusionCommitQuery())
105 ->withRepository($event->getRepository())
106 ->withIdentifiers($identifiers)
109 $commits = mpull($commits, null, 'getCommitIdentifier');
112 foreach ($identifiers as $identifier) {
113 $results[$identifier] = idx($commits, $identifier);
119 private function renderCommitsTable(
120 PhabricatorRepositoryPushEvent
$event,
123 $viewer = $this->getRequest()->getUser();
124 $repository = $event->getRepository();
127 foreach ($commits as $identifier => $commit) {
129 $partial_import = PhabricatorRepositoryCommit
::IMPORTED_MESSAGE |
130 PhabricatorRepositoryCommit
::IMPORTED_CHANGE
;
131 if ($commit->isPartiallyImported($partial_import)) {
132 $summary = AphrontTableView
::renderSingleDisplayLine(
133 $commit->getSummary());
135 $summary = phutil_tag('em', array(), pht('Importing...'));
138 $summary = phutil_tag('em', array(), pht('Discovering...'));
141 $commit_name = $repository->formatCommitName($identifier);
143 $commit_name = phutil_tag(
146 'href' => '/'.$commit_name,
157 $table = id(new AphrontTableView($rows))
158 ->setNoDataString(pht("This push didn't push any new commits."))