Page MenuHomePhabricator

D19849.diff
No OneTemporary

D19849.diff

diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementThawWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementThawWorkflow.php
--- a/src/applications/repository/management/PhabricatorRepositoryManagementThawWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementThawWorkflow.php
@@ -32,6 +32,12 @@
'name' => 'force',
'help' => pht('Run operations without asking for confirmation.'),
),
+ array(
+ 'name' => 'all-repositories',
+ 'help' => pht(
+ 'Apply the promotion or demotion to all repositories hosted '.
+ 'on the device.'),
+ ),
array(
'name' => 'repositories',
'wildcard' => true,
@@ -42,12 +48,6 @@
public function execute(PhutilArgumentParser $args) {
$viewer = $this->getViewer();
- $repositories = $this->loadRepositories($args, 'repositories');
- if (!$repositories) {
- throw new PhutilArgumentUsageException(
- pht('Specify one or more repositories to thaw.'));
- }
-
$promote = $args->getArg('promote');
$demote = $args->getArg('demote');
@@ -72,6 +72,60 @@
pht('No device "%s" exists.', $device_name));
}
+ $repository_names = $args->getArg('repositories');
+ $all_repositories = $args->getArg('all-repositories');
+ if ($repository_names && $all_repositories) {
+ throw new PhutilArgumentUsageException(
+ pht(
+ 'Specify a list of repositories or "--all-repositories", '.
+ 'but not both.'));
+ } else if (!$repository_names && !$all_repositories) {
+ throw new PhutilArgumentUsageException(
+ pht(
+ 'Select repositories to affect by providing a list of repositories '.
+ 'or using the "--all-repositories" flag.'));
+ }
+
+ if ($repository_names) {
+ $repositories = $this->loadRepositories($args, 'repositories');
+ if (!$repositories) {
+ throw new PhutilArgumentUsageException(
+ pht('Specify one or more repositories to thaw.'));
+ }
+ } else {
+ $repositories = array();
+
+ $services = id(new AlmanacServiceQuery())
+ ->setViewer($viewer)
+ ->withDevicePHIDs(array($device->getPHID()))
+ ->execute();
+ if ($services) {
+ $repositories = id(new PhabricatorRepositoryQuery())
+ ->setViewer($viewer)
+ ->withAlmanacServicePHIDs(mpull($services, 'getPHID'))
+ ->execute();
+ }
+
+ if (!$repositories) {
+ throw new PhutilArgumentUsageException(
+ pht('There are no repositories on the selected device.'));
+ }
+ }
+
+ $display_list = new PhutilConsoleList();
+ foreach ($repositories as $repository) {
+ $display_list->addItem(
+ pht(
+ '%s %s',
+ $repository->getMonogram(),
+ $repository->getName()));
+ }
+
+ echo tsprintf(
+ "%s\n\n%B\n",
+ pht('These repositories will be thawed:'),
+ $display_list->drawConsoleString());
+
if ($promote) {
$risk_message = pht(
'Promoting a device can cause the loss of any repository data which '.

File Metadata

Mime Type
text/plain
Expires
Sat, Jan 18, 6:06 PM (7 h, 48 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7007386
Default Alt Text
D19849.diff (3 KB)

Event Timeline