Differential D11789 Diff 28422 src/applications/diffusion/controller/DiffusionRepositoryController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/controller/DiffusionRepositoryController.php
| Show First 20 Lines • Show All 368 Lines • ▼ Show 20 Lines | private function buildBranchListTable(DiffusionRequest $drequest) { | ||||
| $panel->setHeader($header); | $panel->setHeader($header); | ||||
| $panel->appendChild($table); | $panel->appendChild($table); | ||||
| return $panel; | return $panel; | ||||
| } | } | ||||
| private function buildTagListTable(DiffusionRequest $drequest) { | private function buildTagListTable(DiffusionRequest $drequest) { | ||||
| $viewer = $this->getRequest()->getUser(); | $viewer = $this->getRequest()->getUser(); | ||||
| $repository = $drequest->getRepository(); | |||||
| switch ($repository->getVersionControlSystem()) { | |||||
| case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: | |||||
| // no tags in SVN | |||||
| return null; | |||||
| } | |||||
| $tag_limit = 15; | $tag_limit = 15; | ||||
| $tags = array(); | $tags = array(); | ||||
| try { | |||||
| $tags = DiffusionRepositoryTag::newFromConduit( | $tags = DiffusionRepositoryTag::newFromConduit( | ||||
| $this->callConduitWithDiffusionRequest( | $this->callConduitWithDiffusionRequest( | ||||
| 'diffusion.tagsquery', | 'diffusion.tagsquery', | ||||
| array( | array( | ||||
| // On the home page, we want to find tags on any branch. | // On the home page, we want to find tags on any branch. | ||||
| 'commit' => null, | 'commit' => null, | ||||
| 'limit' => $tag_limit + 1, | 'limit' => $tag_limit + 1, | ||||
| ))); | ))); | ||||
| } catch (ConduitException $e) { | |||||
| if ($e->getMessage() != 'ERR-UNSUPPORTED-VCS') { | |||||
| throw $e; | |||||
| } | |||||
| } | |||||
| if (!$tags) { | if (!$tags) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| $more_tags = (count($tags) > $tag_limit); | $more_tags = (count($tags) > $tag_limit); | ||||
| $tags = array_slice($tags, 0, $tag_limit); | $tags = array_slice($tags, 0, $tag_limit); | ||||
| $commits = id(new DiffusionCommitQuery()) | $commits = id(new DiffusionCommitQuery()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->withIdentifiers(mpull($tags, 'getCommitIdentifier')) | ->withIdentifiers(mpull($tags, 'getCommitIdentifier')) | ||||
| ->withRepository($drequest->getRepository()) | ->withRepository($repository) | ||||
| ->needCommitData(true) | ->needCommitData(true) | ||||
| ->execute(); | ->execute(); | ||||
| $view = id(new DiffusionTagListView()) | $view = id(new DiffusionTagListView()) | ||||
| ->setUser($viewer) | ->setUser($viewer) | ||||
| ->setDiffusionRequest($drequest) | ->setDiffusionRequest($drequest) | ||||
| ->setTags($tags) | ->setTags($tags) | ||||
| ->setCommits($commits); | ->setCommits($commits); | ||||
| ▲ Show 20 Lines • Show All 299 Lines • Show Last 20 Lines | |||||