Page MenuHomePhabricator

D15875.diff
No OneTemporary

D15875.diff

diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditActivateController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditActivateController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryEditActivateController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryEditActivateController.php
@@ -47,7 +47,24 @@
$submit = pht('Deactivate Repository');
} else {
$title = pht('Activate Repository');
- $body = pht('Activate this repository?');
+
+ $is_new = $repository->isNewlyInitialized();
+ if ($is_new) {
+ if ($repository->isHosted()) {
+ $body = pht(
+ 'This repository will become a new hosted repository. '.
+ 'It will begin serving read and write traffic.');
+ } else {
+ $body = pht(
+ 'This repository will observe an existing remote repository. '.
+ 'It will begin fetching changes from the remote.');
+ }
+ } else {
+ $body = pht(
+ 'This repository will resume updates, observation, mirroring, '.
+ 'and serving any configured read and write traffic.');
+ }
+
$submit = pht('Activate Repository');
}
diff --git a/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php b/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php
--- a/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php
+++ b/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php
@@ -40,6 +40,8 @@
$viewer = $this->getViewer();
$repository = PhabricatorRepository::initializeNewRepository($viewer);
+ $repository->setDetail('newly-initialized', true);
+
$vcs = $this->getVersionControlSystem();
if ($vcs) {
$repository->setVersionControlSystem($vcs);
diff --git a/src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php
--- a/src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php
+++ b/src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php
@@ -103,7 +103,38 @@
public function buildManagementPanelContent() {
$result = array();
- $result[] = $this->newBox(pht('Repository Basics'), $this->buildBasics());
+ $basics = $this->newBox(pht('Repository Basics'), $this->buildBasics());
+
+ $repository = $this->getRepository();
+ $is_new = $repository->isNewlyInitialized();
+ if ($is_new) {
+ $messages = array();
+
+ $messages[] = pht(
+ 'This newly created repository is not active yet. Configure policies, '.
+ 'options, and URIs. When ready, %s the repository.',
+ phutil_tag('strong', array(), pht('Activate')));
+
+ if ($repository->isHosted()) {
+ $messages[] = pht(
+ 'If activated now, this repository will become a new hosted '.
+ 'repository. To observe an existing repository instead, configure '.
+ 'it in the %s panel.',
+ phutil_tag('strong', array(), pht('URIs')));
+ } else {
+ $messages[] = pht(
+ 'If activated now, this repository will observe an existing remote '.
+ 'repository and begin importing changes.');
+ }
+
+ $info_view = id(new PHUIInfoView())
+ ->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
+ ->setErrors($messages);
+
+ $basics->setInfoView($info_view);
+ }
+
+ $result[] = $basics;
$description = $this->buildDescription();
if ($description) {
diff --git a/src/applications/diffusion/management/DiffusionRepositoryURIsManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryURIsManagementPanel.php
--- a/src/applications/diffusion/management/DiffusionRepositoryURIsManagementPanel.php
+++ b/src/applications/diffusion/management/DiffusionRepositoryURIsManagementPanel.php
@@ -113,18 +113,34 @@
->setTag('a')
->setText(pht('Documentation')));
+ $is_new = $repository->isNewlyInitialized();
+
$messages = array();
if ($repository->isHosted()) {
+ if ($is_new) {
+ $host_message = pht('Phabricator will host this repository.');
+ } else {
+ $host_message = pht('Phabricator is hosting this repository.');
+ }
+
$messages[] = array(
id(new PHUIIconView())->setIcon('fa-folder'),
' ',
- pht('Phabricator is hosting this repository.'),
+ $host_message,
);
} else {
+ if ($is_new) {
+ $observe_message = pht(
+ 'Phabricator will observe a remote repository.');
+ } else {
+ $observe_message = pht(
+ 'This repository is hosted remotely. Phabricator is observing it.');
+ }
+
$messages[] = array(
id(new PHUIIconView())->setIcon('fa-download'),
' ',
- pht('This repository is hosted remotely. Phabricator is observing it.'),
+ $observe_message,
);
}
diff --git a/src/applications/repository/editor/PhabricatorRepositoryEditor.php b/src/applications/repository/editor/PhabricatorRepositoryEditor.php
--- a/src/applications/repository/editor/PhabricatorRepositoryEditor.php
+++ b/src/applications/repository/editor/PhabricatorRepositoryEditor.php
@@ -138,7 +138,15 @@
$object->setVersionControlSystem($xaction->getNewValue());
break;
case PhabricatorRepositoryTransaction::TYPE_ACTIVATE:
- $object->setDetail('tracking-enabled', $xaction->getNewValue());
+ $active = $xaction->getNewValue();
+
+ // The first time a repository is activated, clear the "new repository"
+ // flag so we stop showing setup hints.
+ if ($active) {
+ $object->setDetail('newly-initialized', false);
+ }
+
+ $object->setDetail('tracking-enabled', $active);
break;
case PhabricatorRepositoryTransaction::TYPE_NAME:
$object->setName($xaction->getNewValue());
diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php
--- a/src/applications/repository/storage/PhabricatorRepository.php
+++ b/src/applications/repository/storage/PhabricatorRepository.php
@@ -964,6 +964,10 @@
return (bool)$this->getDetail('importing', false);
}
+ public function isNewlyInitialized() {
+ return (bool)$this->getDetail('newly-initialized', false);
+ }
+
public function loadImportProgress() {
$progress = queryfx_all(
$this->establishConnection('r'),

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 25, 11:58 AM (8 h, 53 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6926108
Default Alt Text
D15875.diff (6 KB)

Event Timeline