diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditActivateController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditActivateController.php index 52ab0d01ca..b383333fbc 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryEditActivateController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditActivateController.php @@ -47,7 +47,24 @@ final class DiffusionRepositoryEditActivateController $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 index 699bd83aa3..7d3d5640ff 100644 --- a/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php +++ b/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php @@ -40,6 +40,8 @@ final class DiffusionRepositoryEditEngine $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 index 96bda40246..b783a63fd8 100644 --- a/src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php +++ b/src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php @@ -103,7 +103,38 @@ final class DiffusionRepositoryBasicsManagementPanel 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 index 5a4e4de79f..333c2f03c8 100644 --- a/src/applications/diffusion/management/DiffusionRepositoryURIsManagementPanel.php +++ b/src/applications/diffusion/management/DiffusionRepositoryURIsManagementPanel.php @@ -113,18 +113,34 @@ final class DiffusionRepositoryURIsManagementPanel ->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 index fb97d7d908..43c95f6b4a 100644 --- a/src/applications/repository/editor/PhabricatorRepositoryEditor.php +++ b/src/applications/repository/editor/PhabricatorRepositoryEditor.php @@ -138,7 +138,15 @@ final class PhabricatorRepositoryEditor $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 index f5e883d20e..36379eda6c 100644 --- a/src/applications/repository/storage/PhabricatorRepository.php +++ b/src/applications/repository/storage/PhabricatorRepository.php @@ -964,6 +964,10 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO 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'),