mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 08:42:41 +01:00
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:
parent
c2eff7c216
commit
0d03bbe43c
4 changed files with 15 additions and 68 deletions
|
@ -2022,7 +2022,6 @@ phutil_register_library_map(array(
|
|||
'PhabricatorRepositoryGraphStream' => 'applications/repository/daemon/PhabricatorRepositoryGraphStream.php',
|
||||
'PhabricatorRepositoryListController' => 'applications/repository/controller/PhabricatorRepositoryListController.php',
|
||||
'PhabricatorRepositoryManagementCacheWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementCacheWorkflow.php',
|
||||
'PhabricatorRepositoryManagementDeleteWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementDeleteWorkflow.php',
|
||||
'PhabricatorRepositoryManagementDiscoverWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementDiscoverWorkflow.php',
|
||||
'PhabricatorRepositoryManagementEditWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementEditWorkflow.php',
|
||||
'PhabricatorRepositoryManagementImportingWorkflow' => 'applications/repository/management/PhabricatorRepositoryManagementImportingWorkflow.php',
|
||||
|
@ -4831,6 +4830,7 @@ phutil_register_library_map(array(
|
|||
1 => 'PhabricatorPolicyInterface',
|
||||
2 => 'PhabricatorFlaggableInterface',
|
||||
3 => 'PhabricatorMarkupInterface',
|
||||
4 => 'PhabricatorDestructableInterface',
|
||||
),
|
||||
'PhabricatorRepositoryArcanistProject' =>
|
||||
array(
|
||||
|
@ -4872,7 +4872,6 @@ phutil_register_library_map(array(
|
|||
'PhabricatorRepositoryGraphStream' => 'Phobject',
|
||||
'PhabricatorRepositoryListController' => 'PhabricatorRepositoryController',
|
||||
'PhabricatorRepositoryManagementCacheWorkflow' => 'PhabricatorRepositoryManagementWorkflow',
|
||||
'PhabricatorRepositoryManagementDeleteWorkflow' => 'PhabricatorRepositoryManagementWorkflow',
|
||||
'PhabricatorRepositoryManagementDiscoverWorkflow' => 'PhabricatorRepositoryManagementWorkflow',
|
||||
'PhabricatorRepositoryManagementEditWorkflow' => 'PhabricatorRepositoryManagementWorkflow',
|
||||
'PhabricatorRepositoryManagementImportingWorkflow' => 'PhabricatorRepositoryManagementWorkflow',
|
||||
|
|
|
@ -29,7 +29,7 @@ final class DiffusionRepositoryEditDeleteController
|
|||
'If you really want to delete the repository, run this command from '.
|
||||
'the command line:');
|
||||
$command = csprintf(
|
||||
'phabricator/ $ ./bin/repository delete %s',
|
||||
'phabricator/ $ ./bin/remove destroy %s',
|
||||
$repository->getCallsign());
|
||||
$text_2 = pht('Repositories touch many objects and as such deletes are '.
|
||||
'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
|
||||
PhabricatorPolicyInterface,
|
||||
PhabricatorFlaggableInterface,
|
||||
PhabricatorMarkupInterface {
|
||||
PhabricatorMarkupInterface,
|
||||
PhabricatorDestructableInterface {
|
||||
|
||||
/**
|
||||
* Shortest hash we'll recognize in raw "a829f32" form.
|
||||
|
@ -1322,4 +1323,15 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorDestructableInterface )----------------------------------- */
|
||||
|
||||
public function destroyObjectPermanently(
|
||||
PhabricatorDestructionEngine $engine) {
|
||||
|
||||
$this->openTransaction();
|
||||
$this->delete();
|
||||
$this->saveTransaction();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue