Allow repositories to be deleted using ./bin/remove.
				
					
				
			Summary: Currently, repositories can be deleted using `./bin/repository delete`. It makes sense to expose this operate to the `./bin/remove` script as well, for consistency. Test Plan: Deleted a repository with `./bin/remove rTEST`. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D9350
This commit is contained in:
		 Joshua Spence
					Joshua Spence
				
			
				
					committed by
					
						 epriestley
						epriestley
					
				
			
			
				
	
			
			
			 epriestley
						epriestley
					
				
			
						parent
						
							c2eff7c216
						
					
				
				
					commit
					0d03bbe43c
				
			| @@ -2022,7 +2022,6 @@ phutil_register_library_map(array( | |||||||
|     'PhabricatorRepositoryGraphStream' => 'applications/repository/daemon/PhabricatorRepositoryGraphStream.php', |     'PhabricatorRepositoryGraphStream' => 'applications/repository/daemon/PhabricatorRepositoryGraphStream.php', | ||||||
|     'PhabricatorRepositoryListController' => 'applications/repository/controller/PhabricatorRepositoryListController.php', |     'PhabricatorRepositoryListController' => 'applications/repository/controller/PhabricatorRepositoryListController.php', | ||||||
|     'PhabricatorRepositoryManagementCacheWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementCacheWorkflow.php', |     'PhabricatorRepositoryManagementCacheWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementCacheWorkflow.php', | ||||||
|     'PhabricatorRepositoryManagementDeleteWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementDeleteWorkflow.php', |  | ||||||
|     'PhabricatorRepositoryManagementDiscoverWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementDiscoverWorkflow.php', |     'PhabricatorRepositoryManagementDiscoverWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementDiscoverWorkflow.php', | ||||||
|     'PhabricatorRepositoryManagementEditWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementEditWorkflow.php', |     'PhabricatorRepositoryManagementEditWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementEditWorkflow.php', | ||||||
|     'PhabricatorRepositoryManagementImportingWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementImportingWorkflow.php', |     'PhabricatorRepositoryManagementImportingWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementImportingWorkflow.php', | ||||||
| @@ -4831,6 +4830,7 @@ phutil_register_library_map(array( | |||||||
|       1 => 'PhabricatorPolicyInterface', |       1 => 'PhabricatorPolicyInterface', | ||||||
|       2 => 'PhabricatorFlaggableInterface', |       2 => 'PhabricatorFlaggableInterface', | ||||||
|       3 => 'PhabricatorMarkupInterface', |       3 => 'PhabricatorMarkupInterface', | ||||||
|  |       4 => 'PhabricatorDestructableInterface', | ||||||
|     ), |     ), | ||||||
|     'PhabricatorRepositoryArcanistProject' => |     'PhabricatorRepositoryArcanistProject' => | ||||||
|     array( |     array( | ||||||
| @@ -4872,7 +4872,6 @@ phutil_register_library_map(array( | |||||||
|     'PhabricatorRepositoryGraphStream' => 'Phobject', |     'PhabricatorRepositoryGraphStream' => 'Phobject', | ||||||
|     'PhabricatorRepositoryListController' => 'PhabricatorRepositoryController', |     'PhabricatorRepositoryListController' => 'PhabricatorRepositoryController', | ||||||
|     'PhabricatorRepositoryManagementCacheWorkflow' => 'PhabricatorRepositoryManagementWorkflow', |     'PhabricatorRepositoryManagementCacheWorkflow' => 'PhabricatorRepositoryManagementWorkflow', | ||||||
|     'PhabricatorRepositoryManagementDeleteWorkflow' => 'PhabricatorRepositoryManagementWorkflow', |  | ||||||
|     'PhabricatorRepositoryManagementDiscoverWorkflow' => 'PhabricatorRepositoryManagementWorkflow', |     'PhabricatorRepositoryManagementDiscoverWorkflow' => 'PhabricatorRepositoryManagementWorkflow', | ||||||
|     'PhabricatorRepositoryManagementEditWorkflow' => 'PhabricatorRepositoryManagementWorkflow', |     'PhabricatorRepositoryManagementEditWorkflow' => 'PhabricatorRepositoryManagementWorkflow', | ||||||
|     'PhabricatorRepositoryManagementImportingWorkflow' => 'PhabricatorRepositoryManagementWorkflow', |     'PhabricatorRepositoryManagementImportingWorkflow' => 'PhabricatorRepositoryManagementWorkflow', | ||||||
|   | |||||||
| @@ -29,7 +29,7 @@ final class DiffusionRepositoryEditDeleteController | |||||||
|       'If you really want to delete the repository, run this command from '. |       'If you really want to delete the repository, run this command from '. | ||||||
|       'the command line:'); |       'the command line:'); | ||||||
|     $command = csprintf( |     $command = csprintf( | ||||||
|       'phabricator/ $ ./bin/repository delete %s', |       'phabricator/ $ ./bin/remove destroy %s', | ||||||
|       $repository->getCallsign()); |       $repository->getCallsign()); | ||||||
|     $text_2 = pht('Repositories touch many objects and as such deletes are '. |     $text_2 = pht('Repositories touch many objects and as such deletes are '. | ||||||
|                   'prohibitively expensive to run from the web UI.'); |                   'prohibitively expensive to run from the web UI.'); | ||||||
|   | |||||||
| @@ -1,64 +0,0 @@ | |||||||
| <?php |  | ||||||
|  |  | ||||||
| final class PhabricatorRepositoryManagementDeleteWorkflow |  | ||||||
|   extends PhabricatorRepositoryManagementWorkflow { |  | ||||||
|  |  | ||||||
|   public function didConstruct() { |  | ||||||
|     $this |  | ||||||
|       ->setName('delete') |  | ||||||
|       ->setExamples('**delete** __repository__ ...') |  | ||||||
|       ->setSynopsis('Delete __repository__, named by callsign.') |  | ||||||
|       ->setArguments( |  | ||||||
|         array( |  | ||||||
|           array( |  | ||||||
|             'name'        => 'verbose', |  | ||||||
|             'help'        => 'Show additional debugging information.', |  | ||||||
|           ), |  | ||||||
|           array( |  | ||||||
|             'name'        => 'force', |  | ||||||
|             'help'        => 'Do not prompt for confirmation.', |  | ||||||
|           ), |  | ||||||
|           array( |  | ||||||
|             'name'        => 'repos', |  | ||||||
|             'wildcard'    => true, |  | ||||||
|           ), |  | ||||||
|         )); |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   public function execute(PhutilArgumentParser $args) { |  | ||||||
|     $repos = $this->loadRepositories($args, 'repos'); |  | ||||||
|  |  | ||||||
|     if (!$repos) { |  | ||||||
|       throw new PhutilArgumentUsageException( |  | ||||||
|         "Specify one or more repositories to delete, by callsign."); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     $console = PhutilConsole::getConsole(); |  | ||||||
|  |  | ||||||
|     if (!$args->getArg('force')) { |  | ||||||
|       $console->writeOut("%s\n\n", pht('These repositories will be deleted:')); |  | ||||||
|  |  | ||||||
|       foreach ($repos as $repo) { |  | ||||||
|         $console->writeOut( |  | ||||||
|           "  %s %s\n", |  | ||||||
|           'r'.$repo->getCallsign(), |  | ||||||
|           $repo->getName()); |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       $prompt = pht('Permanently delete these repositories?'); |  | ||||||
|       if (!$console->confirm($prompt)) { |  | ||||||
|         return 1; |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     foreach ($repos as $repo) { |  | ||||||
|       $console->writeOut("Deleting '%s'...\n", $repo->getCallsign()); |  | ||||||
|       $repo->delete(); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     $console->writeOut("Done.\n"); |  | ||||||
|  |  | ||||||
|     return 0; |  | ||||||
|   } |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @@ -7,7 +7,8 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO | |||||||
|   implements |   implements | ||||||
|     PhabricatorPolicyInterface, |     PhabricatorPolicyInterface, | ||||||
|     PhabricatorFlaggableInterface, |     PhabricatorFlaggableInterface, | ||||||
|     PhabricatorMarkupInterface { |     PhabricatorMarkupInterface, | ||||||
|  |     PhabricatorDestructableInterface { | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * Shortest hash we'll recognize in raw "a829f32" form. |    * Shortest hash we'll recognize in raw "a829f32" form. | ||||||
| @@ -1322,4 +1323,15 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO | |||||||
|     return true; |     return true; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* -(  PhabricatorDestructableInterface  )----------------------------------- */ | ||||||
|  |  | ||||||
|  |   public function destroyObjectPermanently( | ||||||
|  |     PhabricatorDestructionEngine $engine) { | ||||||
|  |  | ||||||
|  |     $this->openTransaction(); | ||||||
|  |     $this->delete(); | ||||||
|  |     $this->saveTransaction(); | ||||||
|  |   } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user