1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +01:00

Make bin/diviner generate --repository <repository> accept identifiers

Summary: Ref T4245. This currently accepts only callsigns; prepare it for the bright new callsign-optional world.

Test Plan:
  - Ran `./bin/diviner generate --repository 1 --book src/docs/book/flavor.book --clean`, got a good result.
  - Ran `./bin/diviner generate --repository 239238 --book src/docs/book/flavor.book --clean`, got an appropraite error about a bad repository identifier.

Reviewers: chad, avivey

Reviewed By: avivey

Maniphest Tasks: T4245

Differential Revision: https://secure.phabricator.com/D15296
This commit is contained in:
epriestley 2016-02-17 17:20:15 -08:00
parent 93d7b01222
commit 097bcb3970

View file

@ -27,7 +27,7 @@ final class DivinerGenerateWorkflow extends DivinerWorkflow {
),
array(
'name' => 'repository',
'param' => 'callsign',
'param' => 'identifier',
'help' => pht('Repository that the documentation belongs to.'),
),
));
@ -192,19 +192,19 @@ final class DivinerGenerateWorkflow extends DivinerWorkflow {
}
$publisher = newv($publisher_class, array());
$callsign = $args->getArg('repository');
$identifier = $args->getArg('repository');
$repository = null;
if ($callsign) {
if (strlen($identifier)) {
$repository = id(new PhabricatorRepositoryQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withCallsigns(array($callsign))
->withIdentifiers(array($identifier))
->executeOne();
if (!$repository) {
throw new PhutilArgumentUsageException(
pht(
"Repository '%s' does not exist.",
$callsign));
'Repository "%s" does not exist.',
$identifier));
}
$publisher->setRepositoryPHID($repository->getPHID());