1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 11:30:55 +01:00

Update import/clear symbols scripts for callsigns

Summary: Ref T4245. Accept identifiers instead of callsigns in these scripts so things continue to work in a future callsign-optional world.

Test Plan: Ran these scripts with both valid and invalid arguments; saw success and errors.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T4245

Differential Revision: https://secure.phabricator.com/D15300
This commit is contained in:
epriestley 2016-02-18 03:09:59 -08:00
parent f557fc9caa
commit 78fba426f6
2 changed files with 18 additions and 14 deletions

View file

@ -6,7 +6,7 @@ require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv); $args = new PhutilArgumentParser($argv);
$args->setSynopsis(<<<EOSYNOPSIS $args->setSynopsis(<<<EOSYNOPSIS
**clear_repository_symbols.php** [__options__] __callsign__ **clear_repository_symbols.php** [__options__] __repository__
Clear repository symbols. Clear repository symbols.
EOSYNOPSIS EOSYNOPSIS
@ -15,24 +15,26 @@ $args->parseStandardArguments();
$args->parse( $args->parse(
array( array(
array( array(
'name' => 'callsign', 'name' => 'repository',
'wildcard' => true, 'wildcard' => true,
), ),
)); ));
$callsigns = $args->getArg('callsign'); $identifiers = $args->getArg('repository');
if (count($callsigns) !== 1) { if (count($identifiers) !== 1) {
$args->printHelpAndExit(); $args->printHelpAndExit();
} }
$callsign = head($callsigns); $identifier = head($identifiers);
$repository = id(new PhabricatorRepositoryQuery()) $repository = id(new PhabricatorRepositoryQuery())
->setViewer(PhabricatorUser::getOmnipotentUser()) ->setViewer(PhabricatorUser::getOmnipotentUser())
->withCallsigns($callsigns) ->withIdentifiers($identifiers)
->executeOne(); ->executeOne();
if (!$repository) { if (!$repository) {
echo pht("Repository '%s' does not exist.", $callsign); echo tsprintf(
"%s\n",
pht('Repository "%s" does not exist.', $identifier));
exit(1); exit(1);
} }

View file

@ -6,7 +6,7 @@ require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv); $args = new PhutilArgumentParser($argv);
$args->setSynopsis(<<<EOSYNOPSIS $args->setSynopsis(<<<EOSYNOPSIS
**import_repository_symbols.php** [__options__] __callsign__ < symbols **import_repository_symbols.php** [__options__] __repository__ < symbols
Import repository symbols (symbols are read from stdin). Import repository symbols (symbols are read from stdin).
EOSYNOPSIS EOSYNOPSIS
@ -35,24 +35,26 @@ $args->parse(
'be part of a single transaction.'), 'be part of a single transaction.'),
), ),
array( array(
'name' => 'callsign', 'name' => 'repository',
'wildcard' => true, 'wildcard' => true,
), ),
)); ));
$callsigns = $args->getArg('callsign'); $identifiers = $args->getArg('repository');
if (count($callsigns) !== 1) { if (count($identifiers) !== 1) {
$args->printHelpAndExit(); $args->printHelpAndExit();
} }
$callsign = head($callsigns); $identifier = head($identifiers);
$repository = id(new PhabricatorRepositoryQuery()) $repository = id(new PhabricatorRepositoryQuery())
->setViewer(PhabricatorUser::getOmnipotentUser()) ->setViewer(PhabricatorUser::getOmnipotentUser())
->withCallsigns($callsigns) ->withIdentifiers($identifiers)
->executeOne(); ->executeOne();
if (!$repository) { if (!$repository) {
echo pht("Repository '%s' does not exist.", $callsign); echo tsprintf(
"%s\n",
pht('Repository "%s" does not exist.', $identifier));
exit(1); exit(1);
} }