Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/storage/PhabricatorRepositoryCommit.php
| <?php | <?php | ||||
| final class PhabricatorRepositoryCommit | final class PhabricatorRepositoryCommit | ||||
| extends PhabricatorRepositoryDAO | extends PhabricatorRepositoryDAO | ||||
| implements | implements | ||||
| PhabricatorPolicyInterface, | PhabricatorPolicyInterface, | ||||
| PhabricatorFlaggableInterface, | PhabricatorFlaggableInterface, | ||||
| PhabricatorProjectInterface, | PhabricatorProjectInterface, | ||||
| PhabricatorTokenReceiverInterface, | PhabricatorTokenReceiverInterface, | ||||
| PhabricatorSubscribableInterface, | PhabricatorSubscribableInterface, | ||||
| PhabricatorMentionableInterface, | PhabricatorMentionableInterface, | ||||
| HarbormasterBuildableInterface, | HarbormasterBuildableInterface, | ||||
| HarbormasterCircleCIBuildableInterface, | |||||
| PhabricatorCustomFieldInterface, | PhabricatorCustomFieldInterface, | ||||
| PhabricatorApplicationTransactionInterface, | PhabricatorApplicationTransactionInterface, | ||||
| PhabricatorFulltextInterface { | PhabricatorFulltextInterface { | ||||
| protected $repositoryID; | protected $repositoryID; | ||||
| protected $phid; | protected $phid; | ||||
| protected $commitIdentifier; | protected $commitIdentifier; | ||||
| protected $epoch; | protected $epoch; | ||||
| ▲ Show 20 Lines • Show All 385 Lines • ▼ Show 20 Lines | return array( | ||||
| 'repository.vcs' => | 'repository.vcs' => | ||||
| pht('The version control system, either "svn", "hg" or "git".'), | pht('The version control system, either "svn", "hg" or "git".'), | ||||
| 'repository.uri' => | 'repository.uri' => | ||||
| pht('The URI to clone or checkout the repository from.'), | pht('The URI to clone or checkout the repository from.'), | ||||
| ); | ); | ||||
| } | } | ||||
| /* -( HarbormasterCircleCIBuildableInterface )----------------------------- */ | |||||
| public function getCircleCIGitHubRepositoryURI() { | |||||
| $repository = $this->getRepository(); | |||||
| $commit_phid = $this->getPHID(); | |||||
| $repository_phid = $repository->getPHID(); | |||||
| if ($repository->isHosted()) { | |||||
| throw new Exception( | |||||
| pht( | |||||
| 'This commit ("%s") is associated with a hosted repository '. | |||||
| '("%s"). Repositories must be imported from GitHub to be built '. | |||||
| 'with CircleCI.', | |||||
| $commit_phid, | |||||
| $repository_phid)); | |||||
| } | |||||
| $remote_uri = $repository->getRemoteURI(); | |||||
| $path = HarbormasterCircleCIBuildStepImplementation::getGitHubPath( | |||||
| $remote_uri); | |||||
| if (!$path) { | |||||
| throw new Exception( | |||||
| pht( | |||||
| 'This commit ("%s") is associated with a repository ("%s") that '. | |||||
| 'with a remote URI ("%s") that does not appear to be hosted on '. | |||||
| 'GitHub. Repositories must be hosted on GitHub to be built with '. | |||||
| 'CircleCI.', | |||||
| $commit_phid, | |||||
| $repository_phid, | |||||
| $remote_uri)); | |||||
| } | |||||
| return $remote_uri; | |||||
| } | |||||
| public function getCircleCIBuildIdentifierType() { | |||||
| return 'revision'; | |||||
| } | |||||
| public function getCircleCIBuildIdentifier() { | |||||
| return $this->getCommitIdentifier(); | |||||
| } | |||||
| /* -( PhabricatorCustomFieldInterface )------------------------------------ */ | /* -( PhabricatorCustomFieldInterface )------------------------------------ */ | ||||
| public function getCustomFieldSpecificationForRole($role) { | public function getCustomFieldSpecificationForRole($role) { | ||||
| return PhabricatorEnv::getEnvConfig('diffusion.fields'); | return PhabricatorEnv::getEnvConfig('diffusion.fields'); | ||||
| } | } | ||||
| public function getCustomFieldBaseClass() { | public function getCustomFieldBaseClass() { | ||||
| ▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines | |||||