1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Allow 'repository.create' to set description and autoclose

Summary:
These are currently not available via Conduit.

Also fix a bug where bad JSON input triggers an error about undefined `$metadata`.

Test Plan: Ran 'repository.create' with and without a description and with and without autoclose. Verified the created repositories had the requested attributes.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D2881
This commit is contained in:
epriestley 2012-06-28 09:54:48 -07:00
parent 6c1c3c3a7a
commit bbfb686db5
3 changed files with 7 additions and 1 deletions

View file

@ -43,6 +43,7 @@ final class PhabricatorConduitAPIController
$log = new PhabricatorConduitMethodCallLog();
$log->setMethod($method);
$metadata = array();
try {

View file

@ -29,6 +29,7 @@ abstract class ConduitAPI_repository_Method extends ConduitAPIMethod {
'uri' => PhabricatorEnv::getProductionURI($repository->getURI()),
'remoteURI' => (string)$repository->getPublicRemoteURI(),
'tracking' => $repository->getDetail('tracking-enabled'),
'description' => $repository->getDetail('description'),
);
}

View file

@ -39,6 +39,7 @@ final class ConduitAPI_repository_create_Method
'name' => 'required string',
'vcs' => 'required enum<git, hg, svn>',
'callsign' => 'required string',
'description' => 'optional string',
'encoding' => 'optional string',
'tracking' => 'optional bool',
'uri' => 'optional string',
@ -53,7 +54,8 @@ final class ConduitAPI_repository_create_Method
'closeCommitsFilter' => 'optional list<string>',
'pullFrequency' => 'optional int',
'defaultBranch' => 'optional string',
'heraldEnabled' => 'optional bool',
'heraldEnabled' => 'optional bool, default = true',
'autocloseEnabled' => 'optional bool, default = true',
'svnUUID' => 'optional string',
);
}
@ -107,6 +109,7 @@ final class ConduitAPI_repository_create_Method
$details = array(
'encoding' => $request->getValue('encoding'),
'description' => $request->getValue('description'),
'tracking-enabled' => (bool)$request->getValue('tracking', true),
'remote-uri' => $request->getValue('uri'),
'local-path' => $request->getValue('localPath'),
@ -123,6 +126,7 @@ final class ConduitAPI_repository_create_Method
'ssh-keyfile' => $request->getValue('sshKeyFile'),
'herald-disabled' => !$request->getValue('heraldEnabled', true),
'svn-subpath' => $request->getValue('svnSubpath'),
'disable-autoclose' => !$request->getValue('autocloseEnabled', true),
);
foreach ($details as $key => $value) {