protected function buildPropertyView(DiffusionRequest $drequest, PhabricatorActionListView $actions)
 {
     $viewer = $this->getRequest()->getUser();
     $view = id(new PHUIPropertyListView())->setUser($viewer)->setActionList($actions);
     $stable_commit = $drequest->getStableCommit();
     $view->addProperty(pht('Commit'), phutil_tag('a', array('href' => $drequest->generateURI(array('action' => 'commit', 'commit' => $stable_commit))), $drequest->getRepository()->formatCommitName($stable_commit)));
     return $view;
 }
 protected function buildPropertyView(DiffusionRequest $drequest, PhabricatorActionListView $actions)
 {
     $viewer = $this->getRequest()->getUser();
     $view = id(new PHUIPropertyListView())->setUser($viewer)->setActionList($actions);
     $stable_commit = $drequest->getStableCommit();
     $callsign = $drequest->getRepository()->getCallsign();
     $view->addProperty(pht('Commit'), phutil_tag('a', array('href' => $drequest->generateURI(array('action' => 'commit', 'commit' => $stable_commit))), $drequest->getRepository()->formatCommitName($stable_commit)));
     if ($drequest->getSymbolicType() == 'tag') {
         $symbolic = $drequest->getSymbolicCommit();
         $view->addProperty(pht('Tag'), $symbolic);
         $tags = $this->callConduitWithDiffusionRequest('diffusion.tagsquery', array('names' => array($symbolic), 'needMessages' => true));
         $tags = DiffusionRepositoryTag::newFromConduit($tags);
         $tags = mpull($tags, null, 'getName');
         $tag = idx($tags, $symbolic);
         if ($tag && strlen($tag->getMessage())) {
             $view->addSectionHeader(pht('Tag Content'));
             $view->addTextContent($this->markupText($tag->getMessage()));
         }
     }
     return $view;
 }
 protected function buildPropertyView(DiffusionRequest $drequest, PhabricatorActionListView $actions)
 {
     $viewer = $this->getViewer();
     $view = id(new PHUIPropertyListView())->setUser($viewer)->setActionList($actions);
     $stable_commit = $drequest->getStableCommit();
     $callsign = $drequest->getRepository()->getCallsign();
     $view->addProperty(pht('Commit'), phutil_tag('a', array('href' => $drequest->generateURI(array('action' => 'commit', 'commit' => $stable_commit))), $drequest->getRepository()->formatCommitName($stable_commit)));
     if ($drequest->getSymbolicType() == 'tag') {
         $symbolic = $drequest->getSymbolicCommit();
         $view->addProperty(pht('Tag'), $symbolic);
         $tags = $this->callConduitWithDiffusionRequest('diffusion.tagsquery', array('names' => array($symbolic), 'needMessages' => true));
         $tags = DiffusionRepositoryTag::newFromConduit($tags);
         $tags = mpull($tags, null, 'getName');
         $tag = idx($tags, $symbolic);
         if ($tag && strlen($tag->getMessage())) {
             $view->addSectionHeader(pht('Tag Content'));
             $view->addTextContent($this->markupText($tag->getMessage()));
         }
     }
     $repository = $drequest->getRepository();
     $owners = 'PhabricatorOwnersApplication';
     if (PhabricatorApplication::isClassInstalled($owners)) {
         $package_query = id(new PhabricatorOwnersPackageQuery())->setViewer($viewer)->withControl($repository->getPHID(), array($drequest->getPath()));
         $package_query->execute();
         $packages = $package_query->getControllingPackagesForPath($repository->getPHID(), $drequest->getPath());
         if ($packages) {
             $ownership = id(new PHUIStatusListView())->setUser($viewer);
             foreach ($packages as $package) {
                 $icon = 'fa-list-alt';
                 $color = 'grey';
                 $item = id(new PHUIStatusItemView())->setIcon($icon, $color)->setTarget($viewer->renderHandle($package->getPHID()));
                 $ownership->addItem($item);
             }
         } else {
             $ownership = phutil_tag('em', array(), pht('None'));
         }
         $view->addProperty(pht('Packages'), $ownership);
     }
     return $view;
 }
 private function buildNormalContent(DiffusionRequest $drequest)
 {
     $repository = $drequest->getRepository();
     $phids = array();
     $content = array();
     try {
         $history_results = $this->callConduitWithDiffusionRequest('diffusion.historyquery', array('commit' => $drequest->getCommit(), 'path' => $drequest->getPath(), 'offset' => 0, 'limit' => 15));
         $history = DiffusionPathChange::newFromConduit($history_results['pathChanges']);
         foreach ($history as $item) {
             $data = $item->getCommitData();
             if ($data) {
                 if ($data->getCommitDetail('authorPHID')) {
                     $phids[$data->getCommitDetail('authorPHID')] = true;
                 }
                 if ($data->getCommitDetail('committerPHID')) {
                     $phids[$data->getCommitDetail('committerPHID')] = true;
                 }
             }
         }
         $history_exception = null;
     } catch (Exception $ex) {
         $history_results = null;
         $history = null;
         $history_exception = $ex;
     }
     try {
         $browse_results = DiffusionBrowseResultSet::newFromConduit($this->callConduitWithDiffusionRequest('diffusion.browsequery', array('path' => $drequest->getPath(), 'commit' => $drequest->getCommit())));
         $browse_paths = $browse_results->getPaths();
         foreach ($browse_paths as $item) {
             $data = $item->getLastCommitData();
             if ($data) {
                 if ($data->getCommitDetail('authorPHID')) {
                     $phids[$data->getCommitDetail('authorPHID')] = true;
                 }
                 if ($data->getCommitDetail('committerPHID')) {
                     $phids[$data->getCommitDetail('committerPHID')] = true;
                 }
             }
         }
         $browse_exception = null;
     } catch (Exception $ex) {
         $browse_results = null;
         $browse_paths = null;
         $browse_exception = $ex;
     }
     $phids = array_keys($phids);
     $handles = $this->loadViewerHandles($phids);
     $readme = null;
     if ($browse_results) {
         $readme_path = $browse_results->getReadmePath();
         if ($readme_path) {
             $readme_content = $this->callConduitWithDiffusionRequest('diffusion.filecontentquery', array('path' => $readme_path, 'commit' => $drequest->getStableCommit()));
             if ($readme_content) {
                 $readme = id(new DiffusionReadmeView())->setUser($this->getViewer())->setPath($readme_path)->setContent($readme_content['corpus']);
             }
         }
     }
     $content[] = $this->buildBrowseTable($browse_results, $browse_paths, $browse_exception, $handles);
     $content[] = $this->buildHistoryTable($history_results, $history, $history_exception);
     try {
         $content[] = $this->buildTagListTable($drequest);
     } catch (Exception $ex) {
         if (!$repository->isImporting()) {
             $content[] = $this->renderStatusMessage(pht('Unable to Load Tags'), $ex->getMessage());
         }
     }
     try {
         $content[] = $this->buildBranchListTable($drequest);
     } catch (Exception $ex) {
         if (!$repository->isImporting()) {
             $content[] = $this->renderStatusMessage(pht('Unable to Load Branches'), $ex->getMessage());
         }
     }
     if ($readme) {
         $content[] = $readme;
     }
     return $content;
 }
 protected function renderCommitHashTag(DiffusionRequest $drequest)
 {
     $stable_commit = $drequest->getStableCommit();
     $commit = phutil_tag('a', array('href' => $drequest->generateURI(array('action' => 'commit', 'commit' => $stable_commit))), $drequest->getRepository()->formatCommitName($stable_commit, true));
     $tag = id(new PHUITagView())->setName($commit)->setShade('indigo')->setType(PHUITagView::TYPE_SHADE);
     return $tag;
 }
 private function buildNormalContent(DiffusionRequest $drequest)
 {
     $repository = $drequest->getRepository();
     $phids = array();
     $content = array();
     try {
         $history_results = $this->callConduitWithDiffusionRequest('diffusion.historyquery', array('commit' => $drequest->getCommit(), 'path' => $drequest->getPath(), 'offset' => 0, 'limit' => 15));
         $history = DiffusionPathChange::newFromConduit($history_results['pathChanges']);
         foreach ($history as $item) {
             $data = $item->getCommitData();
             if ($data) {
                 if ($data->getCommitDetail('authorPHID')) {
                     $phids[$data->getCommitDetail('authorPHID')] = true;
                 }
                 if ($data->getCommitDetail('committerPHID')) {
                     $phids[$data->getCommitDetail('committerPHID')] = true;
                 }
             }
         }
         $history_exception = null;
     } catch (Exception $ex) {
         $history_results = null;
         $history = null;
         $history_exception = $ex;
     }
     try {
         $browse_results = DiffusionBrowseResultSet::newFromConduit($this->callConduitWithDiffusionRequest('diffusion.browsequery', array('path' => $drequest->getPath(), 'commit' => $drequest->getCommit())));
         $browse_paths = $browse_results->getPaths();
         foreach ($browse_paths as $item) {
             $data = $item->getLastCommitData();
             if ($data) {
                 if ($data->getCommitDetail('authorPHID')) {
                     $phids[$data->getCommitDetail('authorPHID')] = true;
                 }
                 if ($data->getCommitDetail('committerPHID')) {
                     $phids[$data->getCommitDetail('committerPHID')] = true;
                 }
             }
         }
         $browse_exception = null;
     } catch (Exception $ex) {
         $browse_results = null;
         $browse_paths = null;
         $browse_exception = $ex;
     }
     $phids = array_keys($phids);
     $handles = $this->loadViewerHandles($phids);
     if ($browse_results) {
         $readme = $this->callConduitWithDiffusionRequest('diffusion.readmequery', array('paths' => $browse_results->getPathDicts(), 'commit' => $drequest->getStableCommit()));
     } else {
         $readme = null;
     }
     $content[] = $this->buildBrowseTable($browse_results, $browse_paths, $browse_exception, $handles);
     $content[] = $this->buildHistoryTable($history_results, $history, $history_exception, $handles);
     try {
         $content[] = $this->buildTagListTable($drequest);
     } catch (Exception $ex) {
         if (!$repository->isImporting()) {
             $content[] = $this->renderStatusMessage(pht('Unable to Load Tags'), $ex->getMessage());
         }
     }
     try {
         $content[] = $this->buildBranchListTable($drequest);
     } catch (Exception $ex) {
         if (!$repository->isImporting()) {
             $content[] = $this->renderStatusMessage(pht('Unable to Load Branches'), $ex->getMessage());
         }
     }
     if ($readme) {
         $box = new PHUIBoxView();
         $box->appendChild($readme);
         $box->addPadding(PHUI::PADDING_LARGE);
         $panel = new PHUIObjectBoxView();
         $panel->setHeaderText(pht('README'));
         $panel->appendChild($box);
         $content[] = $panel;
     }
     return $content;
 }