public function getCommandHelp() { return phutil_console_format(<<<EOTEXT View all assigned tasks. EOTEXT ); }
public function run() { $roots = array(); $roots['libphutil'] = dirname(phutil_get_library_root('phutil')); $roots['arcanist'] = dirname(phutil_get_library_root('arcanist')); foreach ($roots as $lib => $root) { echo "Upgrading {$lib}...\n"; if (!Filesystem::pathExists($root . '/.git')) { throw new ArcanistUsageException("{$lib} must be in its git working copy to be automatically " . "upgraded. This copy of {$lib} (in '{$root}') is not in a git " . "working copy."); } $working_copy = ArcanistWorkingCopyIdentity::newFromPath($root); $configuration_manager = clone $this->getConfigurationManager(); $configuration_manager->setWorkingCopyIdentity($working_copy); $repository_api = ArcanistRepositoryAPI::newAPIFromConfigurationManager($configuration_manager); $this->setRepositoryAPI($repository_api); // Require no local changes. $this->requireCleanWorkingCopy(); // Require the library be on master. $branch_name = $repository_api->getBranchName(); if ($branch_name != 'master') { throw new ArcanistUsageException("{$lib} must be on branch 'master' to be automatically upgraded. " . "This copy of {$lib} (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; }
public function getCommandHelp() { return phutil_console_format(<<<EOTEXT Deprecated. Moved to "close-revision". EOTEXT ); }
public function getCommandHelp() { return phutil_console_format(<<<EOTEXT Supports: cli Create an alias from __command__ to __target__ (optionally, with __options__). For example: arc alias fpatch patch -- --force ...will create a new 'arc' command, 'arc fpatch', which invokes 'arc patch --force ...' when run. NOTE: use "--" before specifying options! If you start an alias with "!", the remainder of the alias will be invoked as a shell command. For example, if you want to implement 'arc ls', you can do so like this: arc alias ls '!ls' You can now run "arc ls" and it will behave like "ls". Of course, this example is silly and would make your life worse. You can not overwrite builtins, including 'alias' itself. The builtin will always execute, even if it was added after your alias. To remove an alias, run: arc alias fpatch Without any arguments, 'arc alias' will list aliases. EOTEXT ); }
public function run() { $revisions = $this->getConduit()->callMethodSynchronous('differential.query', array('authors' => array($this->getUserPHID()), 'status' => 'status-open')); if (!$revisions) { echo "You have no open Differential revisions.\n"; return 0; } $repository_api = $this->getRepositoryAPI(); $info = array(); $status_len = 0; foreach ($revisions as $key => $revision) { $revision_path = Filesystem::resolvePath($revision['sourcePath']); $current_path = Filesystem::resolvePath($repository_api->getPath()); if ($revision_path == $current_path) { $info[$key]['here'] = 1; } else { $info[$key]['here'] = 0; } $info[$key]['sort'] = sprintf('%d%04d%08d', $info[$key]['here'], $revision['status'], $revision['id']); $info[$key]['statusColorized'] = BranchInfo::renderColorizedRevisionStatus($revision['statusName']); $status_len = max($status_len, strlen($info[$key]['statusColorized'])); } $info = isort($info, 'sort'); foreach ($info as $key => $spec) { $revision = $revisions[$key]; printf("%s %-" . ($status_len + 4) . "s D%d: %s\n", $spec['here'] ? phutil_console_format('**%s**', '*') : ' ', $spec['statusColorized'], $revision['id'], $revision['title']); } return 0; }
public function getCommandHelp() { return phutil_console_format(<<<EOTEXT Display inline comments related to a particular revision. EOTEXT ); }
public function getCommandHelp() { return phutil_console_format(<<<TXT Shows coverage data from prior test run TXT ); }
public function getCommandHelp() { return phutil_console_format(<<<EOTEXT Please use arc backout instead EOTEXT ); }
public function run() { $roots = array('libphutil' => dirname(phutil_get_library_root('phutil')), 'arcanist' => dirname(phutil_get_library_root('arcanist'))); foreach ($roots as $lib => $root) { echo phutil_console_format("%s\n", pht('Upgrading %s...', $lib)); $working_copy = ArcanistWorkingCopyIdentity::newFromPath($root); $configuration_manager = clone $this->getConfigurationManager(); $configuration_manager->setWorkingCopyIdentity($working_copy); $repository = ArcanistRepositoryAPI::newAPIFromConfigurationManager($configuration_manager); if (!Filesystem::pathExists($repository->getMetadataPath())) { throw new ArcanistUsageException(pht("%s must be in its git working copy to be automatically upgraded. " . "This copy of %s (in '%s') is not in a git working copy.", $lib, $lib, $root)); } $this->setRepositoryAPI($repository); // Require no local changes. $this->requireCleanWorkingCopy(); // Require the library be on master. $branch_name = $repository->getBranchName(); if ($branch_name != 'master') { throw new ArcanistUsageException(pht("%s must be on branch '%s' to be automatically upgraded. " . "This copy of %s (in '%s') is on branch '%s'.", $lib, 'master', $lib, $root, $branch_name)); } chdir($root); try { phutil_passthru('git pull --rebase'); } catch (Exception $ex) { phutil_passthru('git rebase --abort'); throw $ex; } } echo phutil_console_format("**%s** %s\n", pht('Updated!'), pht('Your copy of arc is now up to date.')); return 0; }
public function run() { $srcdir = dirname(__FILE__) . '/../../'; $engine = new WatchmanIntegrationEngine(); $engine->setProjectRoot($srcdir); $paths = $this->getArgument('args'); $results = $engine->run($paths); $failed = 0; $colors = array('pass' => '<fg:green>OK</fg> ', 'fail' => '<fg:red>FAIL</fg>', 'skip' => '<fg:yellow>SKIP</fg>'); foreach ($results as $result) { $res = $result->getResult(); $status = idx($colors, $res, $res); echo phutil_console_format("{$status} %s (%.2fs)\n", $result->getName(), $result->getDuration()); if ($res == 'pass' || $res == 'skip') { continue; } echo $result->getUserData() . "\n"; $failed++; } if (!$failed) { echo phutil_console_format("\nAll %d tests passed/skipped :successkid:\n", count($results)); } else { echo phutil_console_format("\n%d of %d tests failed\n", $failed, count($results)); } return $failed ? 1 : 0; }
public function didExecute(PhutilArgumentParser $args) { foreach ($this->getAPIs() as $api) { $patches = $this->getPatches(); $applied = $api->getAppliedPatches(); if ($applied === null) { echo phutil_console_format("**%s**: %s\n", pht('Database Not Initialized'), pht('Run **%s** to initialize.', './bin/storage upgrade')); return 1; } $ref = $api->getRef(); $table = id(new PhutilConsoleTable())->setShowHeader(false)->addColumn('id', array('title' => pht('ID')))->addColumn('host', array('title' => pht('Host')))->addColumn('status', array('title' => pht('Status')))->addColumn('duration', array('title' => pht('Duration')))->addColumn('type', array('title' => pht('Type')))->addColumn('name', array('title' => pht('Name'))); $durations = $api->getPatchDurations(); foreach ($patches as $patch) { $duration = idx($durations, $patch->getFullKey()); if ($duration === null) { $duration = '-'; } else { $duration = pht('%s us', new PhutilNumber($duration)); } $table->addRow(array('id' => $patch->getFullKey(), 'host' => $ref->getRefKey(), 'status' => in_array($patch->getFullKey(), $applied) ? pht('Applied') : pht('Not Applied'), 'duration' => $duration, 'type' => $patch->getType(), 'name' => $patch->getName())); } $table->draw(); } return 0; }
public function getCommandHelp() { return phutil_console_format(<<<TXT Generates an RPM suitable for use at Facebook TXT ); }
public function getCommandHelp() { return phutil_console_format(<<<EOTEXT Show what you're currently tracking in Phrequent. EOTEXT ); }
public function getCommandHelp() { return phutil_console_format(<<<EOTEXT Close a task. EOTEXT ); }
private function progress($results, $numTests) { static $colors = array(ArcanistUnitTestResult::RESULT_PASS => 'green', ArcanistUnitTestResult::RESULT_FAIL => 'red', ArcanistUnitTestResult::RESULT_SKIP => 'yellow', ArcanistUnitTestResult::RESULT_BROKEN => 'red', ArcanistUnitTestResult::RESULT_UNSOUND => 'yellow', ArcanistUnitTestResult::RESULT_POSTPONED => 'yellow'); $s = "["; $lastColor = ""; foreach ($results as $result) { $color = $colors[$result->getResult()]; if (!$color && $lastColor) { $s .= "</bg>"; } elseif (!$lastColor && $color) { $s .= "<bg:{$color}>"; } elseif ($lastColor !== $color) { $s .= "</bg><bg:{$color}>"; } $lastColor = $color; $s .= "."; } if ($lastColor) { $s .= "</bg>"; } $c = count($results); if ($numTests) { $s .= str_repeat(" ", $numTests - $c) . " {$c}/{$numTests}]"; } else { $s .= " {$c}]"; } return phutil_console_format($s); }
public function run() { $roots = array(); $roots['libphutil'] = dirname(phutil_get_library_root('phutil')); $roots['arcanist'] = dirname(phutil_get_library_root('arcanist')); foreach ($roots as $lib => $root) { echo "Upgrading {$lib}...\n"; if (!Filesystem::pathExists($root . '/.git')) { throw new ArcanistUsageException("{$lib} must be in its git working copy to be automatically " . "upgraded. This copy of {$lib} (in '{$root}') is not in a git " . "working copy."); } $working_copy = ArcanistWorkingCopyIdentity::newFromPath($root); $repository_api = ArcanistRepositoryAPI::newAPIFromWorkingCopyIdentity($working_copy); // Force the range to HEAD^..HEAD, which is meaningless but keeps us // from triggering "base" rules or other commit range resolution rules // that might prompt the user when we pull the working copy status. $repository_api->setRelativeCommit('HEAD^'); $this->setRepositoryAPI($repository_api); // Require no local changes. $this->requireCleanWorkingCopy(); // Require the library be on master. $branch_name = $repository_api->getBranchName(); if ($branch_name != 'master') { throw new ArcanistUsageException("{$lib} must be on branch 'master' to be automatically upgraded. " . "This copy of {$lib} (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; }
public function getCommandHelp() { return phutil_console_format(<<<EOTEXT There's only one way to find out... EOTEXT ); }
public function run() { $conduit = $this->getConduit(); $started_phids = array(); $short_name = $this->getArgument('name'); foreach ($short_name as $object_name) { $object_lookup = $conduit->callMethodSynchronous('phid.lookup', array('names' => array($object_name))); if (!array_key_exists($object_name, $object_lookup)) { echo "No such object '" . $object_name . "' found.\n"; return 1; } $object_phid = $object_lookup[$object_name]['phid']; $started_phids[] = $conduit->callMethodSynchronous('phrequent.push', array('objectPHID' => $object_phid)); } $phid_query = $conduit->callMethodSynchronous('phid.query', array('phids' => $started_phids)); $name = ''; foreach ($phid_query as $ref) { if ($name === '') { $name = $ref['fullName']; } else { $name .= ', ' . $ref['fullName']; } } echo phutil_console_format("Started: %s\n\n", $name); $this->printCurrentTracking(true); }
public function run() { static $color_map = array('Closed' => 'cyan', 'Needs Review' => 'magenta', 'Needs Revision' => 'red', 'Changes Planned' => 'red', 'Accepted' => 'green', 'No Revision' => 'blue', 'Abandoned' => 'default'); $revisions = $this->getConduit()->callMethodSynchronous('differential.query', array('authors' => array($this->getUserPHID()), 'status' => 'status-open')); if (!$revisions) { echo pht('You have no open Differential revisions.') . "\n"; return 0; } $repository_api = $this->getRepositoryAPI(); $info = array(); foreach ($revisions as $key => $revision) { $revision_path = Filesystem::resolvePath($revision['sourcePath']); $current_path = Filesystem::resolvePath($repository_api->getPath()); if ($revision_path == $current_path) { $info[$key]['exists'] = 1; } else { $info[$key]['exists'] = 0; } $info[$key]['sort'] = sprintf('%d%04d%08d', $info[$key]['exists'], $revision['status'], $revision['id']); $info[$key]['statusName'] = $revision['statusName']; $info[$key]['color'] = idx($color_map, $revision['statusName'], 'default'); } $table = id(new PhutilConsoleTable())->setShowHeader(false)->addColumn('exists', array('title' => ''))->addColumn('status', array('title' => pht('Status')))->addColumn('title', array('title' => pht('Title'))); $info = isort($info, 'sort'); foreach ($info as $key => $spec) { $revision = $revisions[$key]; $table->addRow(array('exists' => $spec['exists'] ? phutil_console_format('**%s**', '*') : '', 'status' => phutil_console_format("<fg:{$spec['color']}>%s</fg>", $spec['statusName']), 'title' => phutil_console_format('**D%d:** %s', $revision['id'], $revision['title']))); } $table->draw(); return 0; }
public function getCommandHelp() { return phutil_console_format(<<<EOTEXT Quickly create a task for yourself. EOTEXT ); }
public function getCommandHelp() { return phutil_console_format(<<<EOTEXT Supports: svn Commit a revision which has been accepted by a reviewer. EOTEXT ); }
public function getCommandHelp() { return phutil_console_format(<<<EOTEXT Supports: git You can install this as a git pre-receive hook. EOTEXT ); }
public function getCommandHelp() { return phutil_console_format(<<<EOTEXT Supports: hg Alias for arc feature. EOTEXT ); }
public function getCommandHelp() { return phutil_console_format(<<<EOTEXT Supports: git, svn, hg List your open Differential revisions. EOTEXT ); }
public function getCommandHelp() { return phutil_console_format(pht(<<<EOTEXT Supports: cli Shows the current version of arcanist. EOTEXT )); }
public function getCommandHelp() { return phutil_console_format(<<<EOTEXT Supports: filesystems Upload a file from local disk. EOTEXT ); }
public function execute(PhutilArgumentParser $args) { $console = PhutilConsole::getConsole(); $repos = id(new PhabricatorRepositoryQuery())->setViewer($this->getViewer())->execute(); if (!$repos) { $console->writeErr("%s\n", pht('There are no repositories.')); return 0; } $from = $args->getArg('from'); if (!strlen($from)) { throw new Exception(pht('You must specify a path prefix to move from with --from.')); } $to = $args->getArg('to'); if (!strlen($to)) { throw new Exception(pht('You must specify a path prefix to move to with --to.')); } $rows = array(); $any_changes = false; foreach ($repos as $repo) { $src = $repo->getLocalPath(); $row = array('repository' => $repo, 'move' => false, 'monogram' => $repo->getMonogram(), 'src' => $src, 'dst' => ''); if (strncmp($src, $from, strlen($from))) { $row['action'] = pht('Ignore'); } else { $dst = $to . substr($src, strlen($from)); $row['action'] = phutil_console_format('**%s**', pht('Move')); $row['dst'] = $dst; $row['move'] = true; $any_changes = true; } $rows[] = $row; } $table = id(new PhutilConsoleTable())->addColumn('action', array('title' => pht('Action')))->addColumn('monogram', array('title' => pht('Repository')))->addColumn('src', array('title' => pht('Src')))->addColumn('dst', array('title' => pht('dst')))->setBorders(true); foreach ($rows as $row) { $display = array_select_keys($row, array('action', 'monogram', 'src', 'dst')); $table->addRow($display); } $table->draw(); if (!$any_changes) { $console->writeOut(pht('No matching repositories.') . "\n"); return 0; } $prompt = pht('Apply these changes?'); if (!phutil_console_confirm($prompt)) { throw new Exception(pht('Declining to apply changes.')); } foreach ($rows as $row) { if (empty($row['move'])) { continue; } $repo = $row['repository']; $details = $repo->getDetails(); $details['local-path'] = $row['dst']; queryfx($repo->establishConnection('w'), 'UPDATE %T SET details = %s WHERE id = %d', $repo->getTableName(), phutil_json_encode($details), $repo->getID()); } $console->writeOut(pht('Applied changes.') . "\n"); return 0; }
public function getCommandHelp() { return phutil_console_format(pht(<<<EOTEXT Supports: cli List the available and configured linters, with information about what they do and which versions are installed. EOTEXT )); }
public function getCommandHelp() { return phutil_console_format(<<<EOTEXT Supports: svn, git, hg Shows which revision is in the working copy (or which revisions, if more than one matches). EOTEXT ); }
public function getCommandHelp() { return phutil_console_format(<<<EOTEXT Supports: bash, etc. Implements shell completion. To use shell completion, source the appropriate script from 'resources/shell/' in your .shellrc. EOTEXT ); }