Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistUpgradeWorkflow.php
<?php | <?php | ||||
final class ArcanistUpgradeWorkflow | final class ArcanistUpgradeWorkflow | ||||
extends ArcanistArcWorkflow { | extends ArcanistArcWorkflow { | ||||
public function getWorkflowName() { | public function getWorkflowName() { | ||||
return 'upgrade'; | return 'upgrade'; | ||||
} | } | ||||
public function getWorkflowInformation() { | public function getWorkflowInformation() { | ||||
$help = pht(<<<EOTEXT | $help = pht(<<<EOTEXT | ||||
Upgrade Arcanist to the latest version. | Upgrade this program to the latest version. | ||||
EOTEXT | EOTEXT | ||||
); | ); | ||||
return $this->newWorkflowInformation() | return $this->newWorkflowInformation() | ||||
->setSynopsis(pht('Upgrade Arcanist to the latest version.')) | ->setSynopsis(pht('Upgrade this program to the latest version.')) | ||||
->addExample(pht('**upgrade**')) | ->addExample(pht('**upgrade**')) | ||||
->setHelp($help); | ->setHelp($help); | ||||
} | } | ||||
public function getWorkflowArguments() { | public function getWorkflowArguments() { | ||||
return array(); | return array(); | ||||
} | } | ||||
Show All 20 Lines | foreach ($roots as $library => $root) { | ||||
$working_copy = ArcanistWorkingCopy::newFromWorkingDirectory($root); | $working_copy = ArcanistWorkingCopy::newFromWorkingDirectory($root); | ||||
$repository_api = $working_copy->getRepositoryAPI(); | $repository_api = $working_copy->getRepositoryAPI(); | ||||
$is_git = ($repository_api instanceof ArcanistGitAPI); | $is_git = ($repository_api instanceof ArcanistGitAPI); | ||||
if (!$is_git) { | if (!$is_git) { | ||||
throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
pht( | pht( | ||||
'The "arc upgrade" workflow uses "git pull" to upgrade '. | 'The "arc upgrade" workflow uses "git pull" to upgrade, but '. | ||||
'Arcanist, but the "arcanist/" directory (in "%s") is not a Git '. | 'the "arcanist/" directory (in "%s") is not a Git working '. | ||||
'working copy. You must leave "arcanist/" as a Git '. | 'copy. You must leave "arcanist/" as a Git working copy to '. | ||||
'working copy to use "arc upgrade".', | 'use "arc upgrade".', | ||||
$root)); | $root)); | ||||
} | } | ||||
// NOTE: Don't use requireCleanWorkingCopy() here because it tries to | // NOTE: Don't use requireCleanWorkingCopy() here because it tries to | ||||
// amend changes and generally move the workflow forward. We just want to | // amend changes and generally move the workflow forward. We just want to | ||||
// abort if there are local changes and make the user sort things out. | // abort if there are local changes and make the user sort things out. | ||||
$uncommitted = $repository_api->getUncommittedStatus(); | $uncommitted = $repository_api->getUncommittedStatus(); | ||||
if ($uncommitted) { | if ($uncommitted) { | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | foreach ($roots as $library => $root) { | ||||
// original exception. | // original exception. | ||||
exec_manual('git rebase --abort'); | exec_manual('git rebase --abort'); | ||||
throw $ex; | throw $ex; | ||||
} | } | ||||
} | } | ||||
$log->writeSuccess( | $log->writeSuccess( | ||||
pht('UPGRADED'), | pht('UPGRADED'), | ||||
pht('Your copy of Arcanist is now up to date.')); | pht('This software is now up to date.')); | ||||
return 0; | return 0; | ||||
} | } | ||||
} | } |