mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-26 15:30:58 +01:00
Expose repository info in arcanist.projectinfo
Summary: This is to reduce number of calls from Arcanist. Test Plan: Called it from web interface. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4146
This commit is contained in:
parent
6ed02e6ee8
commit
0e53731d1d
4 changed files with 17 additions and 14 deletions
|
@ -42,10 +42,12 @@ final class ConduitAPI_arcanist_projectinfo_Method
|
|||
$repository_phid = null;
|
||||
$tracked = false;
|
||||
$encoding = null;
|
||||
$dictionary = array();
|
||||
if ($repository) {
|
||||
$repository_phid = $repository->getPHID();
|
||||
$tracked = $repository->isTracked();
|
||||
$encoding = $repository->getDetail('encoding');
|
||||
$dictionary = $repository->toDictionary();
|
||||
}
|
||||
|
||||
return array(
|
||||
|
@ -54,6 +56,7 @@ final class ConduitAPI_arcanist_projectinfo_Method
|
|||
'repositoryPHID' => $repository_phid,
|
||||
'tracked' => $tracked,
|
||||
'encoding' => $encoding,
|
||||
'repository' => $dictionary,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,17 +5,4 @@
|
|||
*/
|
||||
abstract class ConduitAPI_repository_Method extends ConduitAPIMethod {
|
||||
|
||||
protected function buildDictForRepository(PhabricatorRepository $repository) {
|
||||
return array(
|
||||
'name' => $repository->getName(),
|
||||
'phid' => $repository->getPHID(),
|
||||
'callsign' => $repository->getCallsign(),
|
||||
'vcs' => $repository->getVersionControlSystem(),
|
||||
'uri' => PhabricatorEnv::getProductionURI($repository->getURI()),
|
||||
'remoteURI' => (string)$repository->getPublicRemoteURI(),
|
||||
'tracking' => $repository->getDetail('tracking-enabled'),
|
||||
'description' => $repository->getDetail('description'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ final class ConduitAPI_repository_query_Method
|
|||
|
||||
$results = array();
|
||||
foreach ($repositories as $repository) {
|
||||
$results[] = $this->buildDictForRepository($repository);
|
||||
$results[] = $repository->toDictionary();
|
||||
}
|
||||
|
||||
return $results;
|
||||
|
|
|
@ -36,6 +36,19 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO {
|
|||
PhabricatorPHIDConstants::PHID_TYPE_REPO);
|
||||
}
|
||||
|
||||
public function toDictionary() {
|
||||
return array(
|
||||
'name' => $this->getName(),
|
||||
'phid' => $this->getPHID(),
|
||||
'callsign' => $this->getCallsign(),
|
||||
'vcs' => $this->getVersionControlSystem(),
|
||||
'uri' => PhabricatorEnv::getProductionURI($this->getURI()),
|
||||
'remoteURI' => (string)$this->getPublicRemoteURI(),
|
||||
'tracking' => $this->getDetail('tracking-enabled'),
|
||||
'description' => $this->getDetail('description'),
|
||||
);
|
||||
}
|
||||
|
||||
public function getDetail($key, $default = null) {
|
||||
return idx($this->details, $key, $default);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue