Differential D18811 Diff 45138 src/applications/diffusion/controller/DiffusionRepositoryController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/controller/DiffusionRepositoryController.php
| Show All 40 Lines | public function handleRequest(AphrontRequest $request) { | ||||
| // exists. | // exists. | ||||
| if ($drequest->supportsBranches()) { | if ($drequest->supportsBranches()) { | ||||
| // NOTE: Mercurial may have multiple branch heads with the same name. | // NOTE: Mercurial may have multiple branch heads with the same name. | ||||
| $ref_cursors = id(new PhabricatorRepositoryRefCursorQuery()) | $ref_cursors = id(new PhabricatorRepositoryRefCursorQuery()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->withRepositoryPHIDs(array($repository->getPHID())) | ->withRepositoryPHIDs(array($repository->getPHID())) | ||||
| ->withRefTypes(array(PhabricatorRepositoryRefCursor::TYPE_BRANCH)) | ->withRefTypes(array(PhabricatorRepositoryRefCursor::TYPE_BRANCH)) | ||||
| ->withRefNames(array($drequest->getBranch())) | ->withRefNames(array($drequest->getBranch())) | ||||
| ->needPositions(true) | |||||
| ->execute(); | ->execute(); | ||||
| if ($ref_cursors) { | |||||
| // It's possible that this branch previously existed, but has been | |||||
| // deleted. Make sure we have valid cursor positions, not just cursors. | |||||
| $any_positions = false; | |||||
| foreach ($ref_cursors as $ref_cursor) { | |||||
| if ($ref_cursor->getPositions()) { | |||||
| $any_positions = true; | |||||
| break; | |||||
| } | |||||
| } | |||||
| if ($any_positions) { | |||||
| // This is a valid branch, so we necessarily have some content. | // This is a valid branch, so we necessarily have some content. | ||||
| $page_has_content = true; | $page_has_content = true; | ||||
| } else { | } else { | ||||
| $default = $repository->getDefaultBranch(); | $default = $repository->getDefaultBranch(); | ||||
| if ($default != $drequest->getBranch()) { | if ($default != $drequest->getBranch()) { | ||||
| $empty_title = pht('No Such Branch'); | $empty_title = pht('No Such Branch'); | ||||
| $empty_message = pht( | $empty_message = pht( | ||||
| 'There is no branch named "%s" in this repository.', | 'There is no branch named "%s" in this repository.', | ||||
| ▲ Show 20 Lines • Show All 547 Lines • Show Last 20 Lines | |||||