Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/storage/PhabricatorRepository.php
Show First 20 Lines • Show All 797 Lines • ▼ Show 20 Lines | public function generateURI(array $params) { | ||||
if (idx($params, 'params')) { | if (idx($params, 'params')) { | ||||
$uri->setQueryParams($params['params']); | $uri->setQueryParams($params['params']); | ||||
} | } | ||||
return $uri; | return $uri; | ||||
} | } | ||||
public function updateURIIndex() { | public function updateURIIndex() { | ||||
$uris = array( | $indexes = array(); | ||||
(string)$this->getCloneURIObject(), | |||||
); | |||||
foreach ($uris as $key => $uri) { | $uris = $this->getURIs(); | ||||
$uris[$key] = $this->getNormalizedURI($uri) | foreach ($uris as $uri) { | ||||
->getNormalizedPath(); | if ($uri->getIsDisabled()) { | ||||
continue; | |||||
} | |||||
$indexes[] = $uri->getNormalizedURI(); | |||||
} | } | ||||
PhabricatorRepositoryURIIndex::updateRepositoryURIs( | PhabricatorRepositoryURIIndex::updateRepositoryURIs( | ||||
$this->getPHID(), | $this->getPHID(), | ||||
$uris); | $indexes); | ||||
return $this; | return $this; | ||||
} | } | ||||
private function getNormalizedURI($uri) { | |||||
switch ($this->getVersionControlSystem()) { | |||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: | |||||
return new PhabricatorRepositoryURINormalizer( | |||||
PhabricatorRepositoryURINormalizer::TYPE_GIT, | |||||
$uri); | |||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: | |||||
return new PhabricatorRepositoryURINormalizer( | |||||
PhabricatorRepositoryURINormalizer::TYPE_SVN, | |||||
$uri); | |||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: | |||||
return new PhabricatorRepositoryURINormalizer( | |||||
PhabricatorRepositoryURINormalizer::TYPE_MERCURIAL, | |||||
$uri); | |||||
default: | |||||
throw new Exception(pht('Unrecognized version control system.')); | |||||
} | |||||
} | |||||
public function isTracked() { | public function isTracked() { | ||||
$status = $this->getDetail('tracking-enabled'); | $status = $this->getDetail('tracking-enabled'); | ||||
$map = self::getStatusMap(); | $map = self::getStatusMap(); | ||||
$spec = idx($map, $status); | $spec = idx($map, $status); | ||||
if (!$spec) { | if (!$spec) { | ||||
if ($status) { | if ($status) { | ||||
$status = self::STATUS_ACTIVE; | $status = self::STATUS_ACTIVE; | ||||
▲ Show 20 Lines • Show All 1,566 Lines • Show Last 20 Lines |