diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index ac506ce0f5..0d12e403c4 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -750,16 +750,19 @@ phutil_register_library_map(array( 'DiffusionRepositoryEditAutomationController' => 'applications/diffusion/controller/DiffusionRepositoryEditAutomationController.php', 'DiffusionRepositoryEditBasicController' => 'applications/diffusion/controller/DiffusionRepositoryEditBasicController.php', 'DiffusionRepositoryEditBranchesController' => 'applications/diffusion/controller/DiffusionRepositoryEditBranchesController.php', + 'DiffusionRepositoryEditConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionRepositoryEditConduitAPIMethod.php', 'DiffusionRepositoryEditController' => 'applications/diffusion/controller/DiffusionRepositoryEditController.php', 'DiffusionRepositoryEditDangerousController' => 'applications/diffusion/controller/DiffusionRepositoryEditDangerousController.php', 'DiffusionRepositoryEditDeleteController' => 'applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php', 'DiffusionRepositoryEditEncodingController' => 'applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php', + 'DiffusionRepositoryEditEngine' => 'applications/diffusion/editor/DiffusionRepositoryEditEngine.php', 'DiffusionRepositoryEditHostingController' => 'applications/diffusion/controller/DiffusionRepositoryEditHostingController.php', 'DiffusionRepositoryEditMainController' => 'applications/diffusion/controller/DiffusionRepositoryEditMainController.php', 'DiffusionRepositoryEditStagingController' => 'applications/diffusion/controller/DiffusionRepositoryEditStagingController.php', 'DiffusionRepositoryEditStorageController' => 'applications/diffusion/controller/DiffusionRepositoryEditStorageController.php', 'DiffusionRepositoryEditSubversionController' => 'applications/diffusion/controller/DiffusionRepositoryEditSubversionController.php', 'DiffusionRepositoryEditUpdateController' => 'applications/diffusion/controller/DiffusionRepositoryEditUpdateController.php', + 'DiffusionRepositoryEditproController' => 'applications/diffusion/controller/DiffusionRepositoryEditproController.php', 'DiffusionRepositoryListController' => 'applications/diffusion/controller/DiffusionRepositoryListController.php', 'DiffusionRepositoryManageController' => 'applications/diffusion/controller/DiffusionRepositoryManageController.php', 'DiffusionRepositoryManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryManagementPanel.php', @@ -767,6 +770,7 @@ phutil_register_library_map(array( 'DiffusionRepositoryPath' => 'applications/diffusion/data/DiffusionRepositoryPath.php', 'DiffusionRepositoryRef' => 'applications/diffusion/data/DiffusionRepositoryRef.php', 'DiffusionRepositoryRemarkupRule' => 'applications/diffusion/remarkup/DiffusionRepositoryRemarkupRule.php', + 'DiffusionRepositorySearchConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionRepositorySearchConduitAPIMethod.php', 'DiffusionRepositorySymbolsController' => 'applications/diffusion/controller/DiffusionRepositorySymbolsController.php', 'DiffusionRepositoryTag' => 'applications/diffusion/data/DiffusionRepositoryTag.php', 'DiffusionRepositoryTestAutomationController' => 'applications/diffusion/controller/DiffusionRepositoryTestAutomationController.php', @@ -4941,16 +4945,19 @@ phutil_register_library_map(array( 'DiffusionRepositoryEditAutomationController' => 'DiffusionRepositoryEditController', 'DiffusionRepositoryEditBasicController' => 'DiffusionRepositoryEditController', 'DiffusionRepositoryEditBranchesController' => 'DiffusionRepositoryEditController', + 'DiffusionRepositoryEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod', 'DiffusionRepositoryEditController' => 'DiffusionController', 'DiffusionRepositoryEditDangerousController' => 'DiffusionRepositoryEditController', 'DiffusionRepositoryEditDeleteController' => 'DiffusionRepositoryEditController', 'DiffusionRepositoryEditEncodingController' => 'DiffusionRepositoryEditController', + 'DiffusionRepositoryEditEngine' => 'PhabricatorEditEngine', 'DiffusionRepositoryEditHostingController' => 'DiffusionRepositoryEditController', 'DiffusionRepositoryEditMainController' => 'DiffusionRepositoryEditController', 'DiffusionRepositoryEditStagingController' => 'DiffusionRepositoryEditController', 'DiffusionRepositoryEditStorageController' => 'DiffusionRepositoryEditController', 'DiffusionRepositoryEditSubversionController' => 'DiffusionRepositoryEditController', 'DiffusionRepositoryEditUpdateController' => 'DiffusionRepositoryEditController', + 'DiffusionRepositoryEditproController' => 'DiffusionRepositoryEditController', 'DiffusionRepositoryListController' => 'DiffusionController', 'DiffusionRepositoryManageController' => 'DiffusionController', 'DiffusionRepositoryManagementPanel' => 'Phobject', @@ -4958,6 +4965,7 @@ phutil_register_library_map(array( 'DiffusionRepositoryPath' => 'Phobject', 'DiffusionRepositoryRef' => 'Phobject', 'DiffusionRepositoryRemarkupRule' => 'PhabricatorObjectRemarkupRule', + 'DiffusionRepositorySearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod', 'DiffusionRepositorySymbolsController' => 'DiffusionRepositoryEditController', 'DiffusionRepositoryTag' => 'Phobject', 'DiffusionRepositoryTestAutomationController' => 'DiffusionRepositoryEditController', @@ -7747,6 +7755,7 @@ phutil_register_library_map(array( 'PhabricatorDestructibleInterface', 'PhabricatorProjectInterface', 'PhabricatorSpacesInterface', + 'PhabricatorConduitResultInterface', ), 'PhabricatorRepositoryAuditRequest' => array( 'PhabricatorRepositoryDAO', diff --git a/src/applications/diffusion/application/PhabricatorDiffusionApplication.php b/src/applications/diffusion/application/PhabricatorDiffusionApplication.php index b65ec43937..775bdc203e 100644 --- a/src/applications/diffusion/application/PhabricatorDiffusionApplication.php +++ b/src/applications/diffusion/application/PhabricatorDiffusionApplication.php @@ -55,8 +55,10 @@ final class PhabricatorDiffusionApplication extends PhabricatorApplication { => 'DiffusionCommitController', '/diffusion/' => array( - '(?:query/(?P[^/]+)/)?' + $this->getQueryRoutePattern() => 'DiffusionRepositoryListController', + $this->getEditRoutePattern('editpro/') => + 'DiffusionRepositoryEditproController', 'new/' => 'DiffusionRepositoryNewController', '(?Pcreate)/' => 'DiffusionRepositoryCreateController', '(?Pimport)/' => 'DiffusionRepositoryCreateController', diff --git a/src/applications/diffusion/conduit/DiffusionRepositoryEditConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionRepositoryEditConduitAPIMethod.php new file mode 100644 index 0000000000..af4cc05bb8 --- /dev/null +++ b/src/applications/diffusion/conduit/DiffusionRepositoryEditConduitAPIMethod.php @@ -0,0 +1,20 @@ +setController($this) + ->buildResponse(); + } + +} diff --git a/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php b/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php new file mode 100644 index 0000000000..2bf99c1bc5 --- /dev/null +++ b/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php @@ -0,0 +1,84 @@ +getViewer(); + return PhabricatorRepository::initializeNewRepository($viewer); + } + + protected function newObjectQuery() { + return new PhabricatorRepositoryQuery(); + } + + protected function getObjectCreateTitleText($object) { + return pht('Create Repository'); + } + + protected function getObjectCreateButtonText($object) { + return pht('Create Repository'); + } + + protected function getObjectEditTitleText($object) { + return pht('Edit Repository: %s', $object->getName()); + } + + protected function getObjectEditShortText($object) { + return $object->getDisplayName(); + } + + protected function getObjectCreateShortText() { + return pht('Create Repository'); + } + + protected function getObjectName() { + return pht('Repository'); + } + + protected function getObjectViewURI($object) { + return $object->getPathURI('manage/'); + } + + protected function getCreateNewObjectPolicy() { + return $this->getApplication()->getPolicy( + DiffusionCreateRepositoriesCapability::CAPABILITY); + } + + protected function buildCustomEditFields($object) { + return array( + id(new PhabricatorTextEditField()) + ->setKey('name') + ->setLabel(pht('Name')) + ->setIsRequired(true) + ->setTransactionType(PhabricatorRepositoryTransaction::TYPE_NAME) + ->setDescription(pht('The repository name.')) + ->setConduitDescription(pht('Rename the repository.')) + ->setConduitTypeDescription(pht('New repository name.')) + ->setValue($object->getName()), + ); + } + +} diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php index 22a28daaa3..9bcc740f83 100644 --- a/src/applications/repository/storage/PhabricatorRepository.php +++ b/src/applications/repository/storage/PhabricatorRepository.php @@ -13,7 +13,8 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO PhabricatorMarkupInterface, PhabricatorDestructibleInterface, PhabricatorProjectInterface, - PhabricatorSpacesInterface { + PhabricatorSpacesInterface, + PhabricatorConduitResultInterface { /** * Shortest hash we'll recognize in raw "a829f32" form. @@ -2626,4 +2627,42 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO return $this->spacePHID; } +/* -( PhabricatorConduitResultInterface )---------------------------------- */ + + + public function getFieldSpecificationsForConduit() { + return array( + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('name') + ->setType('string') + ->setDescription(pht('The repository name.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('vcs') + ->setType('string') + ->setDescription( + pht('The VCS this repository uses ("git", "hg" or "svn").')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('callsign') + ->setType('string') + ->setDescription(pht('The repository callsign, if it has one.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('shortName') + ->setType('string') + ->setDescription(pht('Unique short name, if the repository has one.')), + ); + } + + public function getFieldValuesForConduit() { + return array( + 'name' => $this->getName(), + 'vcs' => $this->getVersionControlSystem(), + 'callsign' => $this->getCallsign(), + 'shortName' => $this->getRepositorySlug(), + ); + } + + public function getConduitSearchAttachments() { + return array(); + } + }