Page MenuHomePhabricator

D18439.id44305.diff
No OneTemporary

D18439.id44305.diff

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,8 +34,15 @@
// 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.
@@ -52,21 +59,42 @@
$page_has_content = true;
} else {
$default = $repository->getDefaultBranch();
+ $has_issues = true;
if ($default != $drequest->getBranch()) {
- $empty_title = pht('No Such Branch');
- $empty_message = pht(
- 'There is no branch named "%s" in this repository.',
- $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 {
- $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);
+ $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));
}
}
}
+ if ($drequest->supportsBranches()) {
+ $branch = $drequest->getBranch();
+ $tracking = $repository->shouldTrackBranch($branch);
+ 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()));
+ }
+ }
+
// If we didn't find any branches, check if there are any commits at all.
// This can tailor the message for empty repositories.
$any_commit = null;
@@ -81,8 +109,10 @@
$page_has_content = true;
}
} 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 +122,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 +164,7 @@
->setHeader($header)
->setFooter(array(
$bar,
+ $notices,
$description,
$content,
));

File Metadata

Mime Type
text/plain
Expires
Oct 15 2025, 7:36 PM (6 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8813368
Default Alt Text
D18439.id44305.diff (4 KB)

Event Timeline