setRepositoryAPI($repository_api); // Require no local changes. $this->requireCleanWorkingCopy(); // Require arc be on master. $branch_name = $repository_api->getBranchName(); if ($branch_name != 'master') { throw new ArcanistUsageException( "arc must be on branch 'master' to be automatically upgraded. ". "This copy of arc (in '{$root}') is on branch '{$branch_name}'."); } chdir($root); try { phutil_passthru('git pull --rebase'); } catch (Exception $ex) { phutil_passthru('git rebase --abort'); throw $ex; } echo phutil_console_wrap( phutil_console_format( "**Updated!** Your copy of arc is now up to date.\n")); return 0; } }