Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/storage/PhabricatorRepository.php
Show First 20 Lines • Show All 2,751 Lines • ▼ Show 20 Lines | return array( | ||||
'The Almanac Service that hosts this repository, if the '. | 'The Almanac Service that hosts this repository, if the '. | ||||
'repository is clustered.')), | 'repository is clustered.')), | ||||
id(new PhabricatorConduitSearchFieldSpecification()) | id(new PhabricatorConduitSearchFieldSpecification()) | ||||
->setKey('refRules') | ->setKey('refRules') | ||||
->setType('map<string, list<string>>') | ->setType('map<string, list<string>>') | ||||
->setDescription( | ->setDescription( | ||||
pht( | pht( | ||||
'The "Fetch" and "Permanent Ref" rules for this repository.')), | 'The "Fetch" and "Permanent Ref" rules for this repository.')), | ||||
id(new PhabricatorConduitSearchFieldSpecification()) | |||||
->setKey('defaultBranch') | |||||
->setType('string?') | |||||
->setDescription(pht('Default branch name.')), | |||||
id(new PhabricatorConduitSearchFieldSpecification()) | |||||
->setKey('description') | |||||
->setType('remarkup') | |||||
->setDescription(pht('Repository description.')), | |||||
); | ); | ||||
} | } | ||||
public function getFieldValuesForConduit() { | public function getFieldValuesForConduit() { | ||||
$fetch_rules = $this->getFetchRules(); | $fetch_rules = $this->getFetchRules(); | ||||
$track_rules = $this->getTrackOnlyRules(); | $track_rules = $this->getTrackOnlyRules(); | ||||
$permanent_rules = $this->getPermanentRefRules(); | $permanent_rules = $this->getPermanentRefRules(); | ||||
$fetch_rules = $this->getStringListForConduit($fetch_rules); | $fetch_rules = $this->getStringListForConduit($fetch_rules); | ||||
$track_rules = $this->getStringListForConduit($track_rules); | $track_rules = $this->getStringListForConduit($track_rules); | ||||
$permanent_rules = $this->getStringListForConduit($permanent_rules); | $permanent_rules = $this->getStringListForConduit($permanent_rules); | ||||
$default_branch = $this->getDefaultBranch(); | |||||
if (!strlen($default_branch)) { | |||||
$default_branch = null; | |||||
} | |||||
return array( | return array( | ||||
'name' => $this->getName(), | 'name' => $this->getName(), | ||||
'vcs' => $this->getVersionControlSystem(), | 'vcs' => $this->getVersionControlSystem(), | ||||
'callsign' => $this->getCallsign(), | 'callsign' => $this->getCallsign(), | ||||
'shortName' => $this->getRepositorySlug(), | 'shortName' => $this->getRepositorySlug(), | ||||
'status' => $this->getStatus(), | 'status' => $this->getStatus(), | ||||
'isImporting' => (bool)$this->isImporting(), | 'isImporting' => (bool)$this->isImporting(), | ||||
'almanacServicePHID' => $this->getAlmanacServicePHID(), | 'almanacServicePHID' => $this->getAlmanacServicePHID(), | ||||
'refRules' => array( | 'refRules' => array( | ||||
'fetchRules' => $fetch_rules, | 'fetchRules' => $fetch_rules, | ||||
'trackRules' => $track_rules, | 'trackRules' => $track_rules, | ||||
'permanentRefRules' => $permanent_rules, | 'permanentRefRules' => $permanent_rules, | ||||
), | ), | ||||
'defaultBranch' => $default_branch, | |||||
'description' => array( | |||||
'raw' => (string)$this->getDetail('description'), | |||||
), | |||||
); | ); | ||||
} | } | ||||
private function getStringListForConduit($list) { | private function getStringListForConduit($list) { | ||||
if (!is_array($list)) { | if (!is_array($list)) { | ||||
$list = array(); | $list = array(); | ||||
} | } | ||||
foreach ($list as $key => $value) { | foreach ($list as $key => $value) { | ||||
$value = (string)$value; | $value = (string)$value; | ||||
if (!strlen($value)) { | if (!strlen($value)) { | ||||
unset($list[$key]); | unset($list[$key]); | ||||
} | } | ||||
} | } | ||||
return array_values($list); | return array_values($list); | ||||
} | } | ||||
public function getConduitSearchAttachments() { | public function getConduitSearchAttachments() { | ||||
return array( | return array( | ||||
id(new DiffusionRepositoryURIsSearchEngineAttachment()) | id(new DiffusionRepositoryURIsSearchEngineAttachment()) | ||||
->setAttachmentKey('uris'), | ->setAttachmentKey('uris'), | ||||
id(new DiffusionRepositoryMetricsSearchEngineAttachment()) | |||||
->setAttachmentKey('metrics'), | |||||
); | ); | ||||
} | } | ||||
/* -( PhabricatorFulltextInterface )--------------------------------------- */ | /* -( PhabricatorFulltextInterface )--------------------------------------- */ | ||||
public function newFulltextEngine() { | public function newFulltextEngine() { | ||||
return new PhabricatorRepositoryFulltextEngine(); | return new PhabricatorRepositoryFulltextEngine(); | ||||
Show All 11 Lines |