Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F18861432
D18439.id44306.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D18439.id44306.diff
View Options
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryController.php b/src/applications/diffusion/controller/DiffusionRepositoryController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryController.php
@@ -34,12 +34,20 @@
// Before we do any work, make sure we're looking at a some content: we're
// on a valid branch, and the repository is not empty.
$page_has_content = false;
- $empty_title = null;
- $empty_message = null;
+ $notices = array();
+
+ if (!$repository->isTracked()) {
+ $notices[] = id(new PHUIInfoView())
+ ->setSeverity(PHUIInfoView::SEVERITY_ERROR)
+ ->setTitle(pht('Not Activated'))
+ ->appendChild(pht('This repository is not currently active. You can '.
+ 're-enable it under "Manage Repository".'));
+ }
// If this VCS supports branches, check that the selected branch actually
// exists.
if ($drequest->supportsBranches()) {
+ $tracking = $repository->shouldTrackBranch($drequest->getBranch());
// NOTE: Mercurial may have multiple branch heads with the same name.
$ref_cursors = id(new PhabricatorRepositoryRefCursorQuery())
->setViewer($viewer)
@@ -47,23 +55,9 @@
->withRefTypes(array(PhabricatorRepositoryRefCursor::TYPE_BRANCH))
->withRefNames(array($drequest->getBranch()))
->execute();
- if ($ref_cursors) {
+ if ($ref_cursors && $tracking) {
// This is a valid branch, so we necessarily have some content.
$page_has_content = true;
- } else {
- $default = $repository->getDefaultBranch();
- if ($default != $drequest->getBranch()) {
- $empty_title = pht('No Such Branch');
- $empty_message = pht(
- 'There is no branch named "%s" in this repository.',
- $drequest->getBranch());
- } else {
- $empty_title = pht('No Default Branch');
- $empty_message = pht(
- 'This repository is configured with default branch "%s" but '.
- 'there is no branch with that name in this repository.',
- $default);
- }
}
}
@@ -77,12 +71,44 @@
->setLimit(1)
->execute();
if ($any_commit) {
+ // Subversion
if (!$drequest->supportsBranches()) {
$page_has_content = true;
}
+ $default = $repository->getDefaultBranch();
+ $tracking = $repository->shouldTrackBranch($drequest->getBranch());
+ if (!$tracking) {
+ $page_has_content = false;
+ $notices[] = id(new PHUIInfoView())
+ ->setSeverity(PHUIInfoView::SEVERITY_WARNING)
+ ->setTitle('Not Tracked')
+ ->appendChild(pht('The branch "%s" is not being tracked. You can '.
+ 'enable tracking under "Branches" in "Manage Repository".',
+ $drequest->getBranch()));
+ } else if ($default != $drequest->getBranch()) {
+ $notices[] = id(new PHUIInfoView())
+ ->setSeverity(PHUIInfoView::SEVERITY_WARNING)
+ ->setTitle(pht('No Such Branch'))
+ ->appendChild(
+ pht(
+ 'There is no branch named "%s" in this repository.',
+ $drequest->getBranch()));
+ } else {
+ $notices[] = id(new PHUIInfoView())
+ ->setSeverity(PHUIInfoView::SEVERITY_WARNING)
+ ->setTitle(pht('No Default Branch'))
+ ->appendChild(
+ pht(
+ 'This repository is configured with default branch "%s" but '.
+ 'there is no branch with that name in this repository.',
+ $default));
+ }
+
} else {
- $empty_title = pht('Empty Repository');
- $empty_message = pht('This repository does not have any commits yet.');
+ $notices[] = id(new PHUIInfoView())
+ ->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
+ ->setTitle('No Commits')
+ ->appendChild(pht('This repository does not have any commits yet.'));
}
}
@@ -92,10 +118,7 @@
// If we have a commit somewhere, find branches.
// TODO: Evan will replace
// $this->buildNormalContent($drequest);
- $content = id(new PHUIInfoView())
- ->setTitle($empty_title)
- ->setSeverity(PHUIInfoView::SEVERITY_WARNING)
- ->setErrors(array($empty_message));
+ $content = null;
}
$tabs = $this->buildTabsView('code');
@@ -137,6 +160,7 @@
->setHeader($header)
->setFooter(array(
$bar,
+ $notices,
$description,
$content,
));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 3, 3:26 PM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8720479
Default Alt Text
D18439.id44306.diff (4 KB)
Attached To
Mode
D18439: Show error message in Diffusion if branch is not tracked
Attached
Detach File
Event Timeline
Log In to Comment