Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13999488
D15736.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
12 KB
Referenced Files
None
Subscribers
None
D15736.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -750,16 +750,19 @@
'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 @@
'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 @@
'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 @@
'DiffusionRepositoryPath' => 'Phobject',
'DiffusionRepositoryRef' => 'Phobject',
'DiffusionRepositoryRemarkupRule' => 'PhabricatorObjectRemarkupRule',
+ 'DiffusionRepositorySearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
'DiffusionRepositorySymbolsController' => 'DiffusionRepositoryEditController',
'DiffusionRepositoryTag' => 'Phobject',
'DiffusionRepositoryTestAutomationController' => 'DiffusionRepositoryEditController',
@@ -7747,6 +7755,7 @@
'PhabricatorDestructibleInterface',
'PhabricatorProjectInterface',
'PhabricatorSpacesInterface',
+ 'PhabricatorConduitResultInterface',
),
'PhabricatorRepositoryAuditRequest' => array(
'PhabricatorRepositoryDAO',
diff --git a/src/applications/diffusion/application/PhabricatorDiffusionApplication.php b/src/applications/diffusion/application/PhabricatorDiffusionApplication.php
--- a/src/applications/diffusion/application/PhabricatorDiffusionApplication.php
+++ b/src/applications/diffusion/application/PhabricatorDiffusionApplication.php
@@ -55,8 +55,10 @@
=> 'DiffusionCommitController',
'/diffusion/' => array(
- '(?:query/(?P<queryKey>[^/]+)/)?'
+ $this->getQueryRoutePattern()
=> 'DiffusionRepositoryListController',
+ $this->getEditRoutePattern('editpro/') =>
+ 'DiffusionRepositoryEditproController',
'new/' => 'DiffusionRepositoryNewController',
'(?P<edit>create)/' => 'DiffusionRepositoryCreateController',
'(?P<edit>import)/' => 'DiffusionRepositoryCreateController',
diff --git a/src/applications/diffusion/conduit/DiffusionRepositoryEditConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionRepositoryEditConduitAPIMethod.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diffusion/conduit/DiffusionRepositoryEditConduitAPIMethod.php
@@ -0,0 +1,20 @@
+<?php
+
+final class DiffusionRepositoryEditConduitAPIMethod
+ extends PhabricatorEditEngineAPIMethod {
+
+ public function getAPIMethodName() {
+ return 'diffusion.repository.edit';
+ }
+
+ public function newEditEngine() {
+ return new DiffusionRepositoryEditEngine();
+ }
+
+ public function getMethodSummary() {
+ return pht(
+ 'Apply transactions to create a new repository or edit an existing '.
+ 'one.');
+ }
+
+}
diff --git a/src/applications/diffusion/conduit/DiffusionRepositorySearchConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionRepositorySearchConduitAPIMethod.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diffusion/conduit/DiffusionRepositorySearchConduitAPIMethod.php
@@ -0,0 +1,18 @@
+<?php
+
+final class DiffusionRepositorySearchConduitAPIMethod
+ extends PhabricatorSearchEngineAPIMethod {
+
+ public function getAPIMethodName() {
+ return 'diffusion.repository.search';
+ }
+
+ public function newSearchEngine() {
+ return new PhabricatorRepositorySearchEngine();
+ }
+
+ public function getMethodSummary() {
+ return pht('Read information about repositories.');
+ }
+
+}
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditproController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditproController.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diffusion/controller/DiffusionRepositoryEditproController.php
@@ -0,0 +1,12 @@
+<?php
+
+final class DiffusionRepositoryEditproController
+ extends DiffusionRepositoryEditController {
+
+ public function handleRequest(AphrontRequest $request) {
+ return id(new DiffusionRepositoryEditEngine())
+ ->setController($this)
+ ->buildResponse();
+ }
+
+}
diff --git a/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php b/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php
@@ -0,0 +1,84 @@
+<?php
+
+final class DiffusionRepositoryEditEngine
+ extends PhabricatorEditEngine {
+
+ const ENGINECONST = 'diffusion.repository';
+
+ public function isEngineConfigurable() {
+ return false;
+ }
+
+ public function getEngineName() {
+ return pht('Repositories');
+ }
+
+ public function getSummaryHeader() {
+ return pht('Edit Repositories');
+ }
+
+ public function getSummaryText() {
+ return pht('Creates and edits repositories.');
+ }
+
+ public function getEngineApplicationClass() {
+ return 'PhabricatorDiffusionApplication';
+ }
+
+ protected function newEditableObject() {
+ $viewer = $this->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
--- a/src/applications/repository/storage/PhabricatorRepository.php
+++ b/src/applications/repository/storage/PhabricatorRepository.php
@@ -13,7 +13,8 @@
PhabricatorMarkupInterface,
PhabricatorDestructibleInterface,
PhabricatorProjectInterface,
- PhabricatorSpacesInterface {
+ PhabricatorSpacesInterface,
+ PhabricatorConduitResultInterface {
/**
* Shortest hash we'll recognize in raw "a829f32" form.
@@ -2626,4 +2627,42 @@
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();
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 25, 3:09 PM (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6719449
Default Alt Text
D15736.diff (12 KB)
Attached To
Mode
D15736: Trivially implement RepositoryEditEngine and API methods
Attached
Detach File
Event Timeline
Log In to Comment