Diffusion - tag queries => conduit
Summary: title. Ref T2784. Test Plan: foreach of SVN, Mercurial, and Git, loaded up a repository. Verified that only git had a tags box and it showed up correctly. Went to CALLSIGN/tags and verified that only git had a tags box and it showed up correctly. Went to various commits across vcs and verified it said "none" unless it was a git commit that also was tagged. Reviewers: epriestley Reviewed By: epriestley CC: chad, aran, Korvin Maniphest Tasks: T2784 Differential Revision: https://secure.phabricator.com/D5894
This commit is contained in:
@@ -10,9 +10,19 @@ final class DiffusionCommitTagsController extends DiffusionController {
|
||||
$request = $this->getDiffusionRequest();
|
||||
$tag_limit = 10;
|
||||
|
||||
$tag_query = DiffusionCommitTagsQuery::newFromDiffusionRequest($request);
|
||||
$tag_query->setLimit($tag_limit + 1);
|
||||
$tags = $tag_query->loadTags();
|
||||
$tags = array();
|
||||
try {
|
||||
$tags = DiffusionRepositoryTag::newFromConduit(
|
||||
$this->callConduitWithDiffusionRequest(
|
||||
'diffusion.tagsquery',
|
||||
array(
|
||||
'commit' => $request->getCommit(),
|
||||
'limit' => $tag_limit + 1)));
|
||||
} catch (ConduitException $ex) {
|
||||
if ($ex->getMessage() != 'ERR-UNSUPPORTED-VCS') {
|
||||
throw $ex;
|
||||
}
|
||||
}
|
||||
|
||||
$has_more_tags = (count($tags) > $tag_limit);
|
||||
$tags = array_slice($tags, 0, $tag_limit);
|
||||
|
||||
@@ -216,10 +216,17 @@ final class DiffusionRepositoryController extends DiffusionController {
|
||||
|
||||
private function buildTagListTable(DiffusionRequest $drequest) {
|
||||
$tag_limit = 15;
|
||||
|
||||
$query = DiffusionTagListQuery::newFromDiffusionRequest($drequest);
|
||||
$query->setLimit($tag_limit + 1);
|
||||
$tags = $query->loadTags();
|
||||
$tags = array();
|
||||
try {
|
||||
$tags = DiffusionRepositoryTag::newFromConduit(
|
||||
$this->callConduitWithDiffusionRequest(
|
||||
'diffusion.tagsquery',
|
||||
array('limit' => $tag_limit + 1)));
|
||||
} catch (ConduitException $e) {
|
||||
if ($e->getMessage() != 'ERR-UNSUPPORTED-VCS') {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$tags) {
|
||||
return null;
|
||||
|
||||
@@ -13,22 +13,27 @@ final class DiffusionTagListController extends DiffusionController {
|
||||
$pager->setURI($request->getRequestURI(), 'offset');
|
||||
$pager->setOffset($request->getInt('offset'));
|
||||
|
||||
$params = array(
|
||||
'limit' => $pager->getPageSize() + 1,
|
||||
'offset' => $pager->getOffset());
|
||||
if ($drequest->getRawCommit()) {
|
||||
$is_commit = true;
|
||||
|
||||
$query = DiffusionCommitTagsQuery::newFromDiffusionRequest($drequest);
|
||||
$query->setOffset($pager->getOffset());
|
||||
$query->setLimit($pager->getPageSize() + 1);
|
||||
$tags = $query->loadTags();
|
||||
$params['commit'] = $request->getCommit();
|
||||
} else {
|
||||
$is_commit = false;
|
||||
|
||||
$query = DiffusionTagListQuery::newFromDiffusionRequest($drequest);
|
||||
$query->setOffset($pager->getOffset());
|
||||
$query->setLimit($pager->getPageSize() + 1);
|
||||
$tags = $query->loadTags();
|
||||
}
|
||||
|
||||
$tags = array();
|
||||
try {
|
||||
$conduit_result = $this->callConduitWithDiffusionRequest(
|
||||
'diffusion.tagsquery',
|
||||
$params);
|
||||
$tags = DiffusionRepositoryTag::newFromConduit($conduit_result);
|
||||
} catch (ConduitException $ex) {
|
||||
if ($ex->getMessage() != 'ERR-UNSUPPORTED-VCS') {
|
||||
throw $ex;
|
||||
}
|
||||
}
|
||||
$tags = $pager->sliceResults($tags);
|
||||
|
||||
$content = null;
|
||||
|
||||
Reference in New Issue
Block a user