Changeset View
Changeset View
Standalone View
Standalone View
src/repository/api/ArcanistRepositoryAPI.php
| Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | abstract class ArcanistRepositoryAPI { | ||||
| public static function newAPIFromConfigurationManager( | public static function newAPIFromConfigurationManager( | ||||
| ArcanistConfigurationManager $configuration_manager) { | ArcanistConfigurationManager $configuration_manager) { | ||||
| $working_copy = $configuration_manager->getWorkingCopyIdentity(); | $working_copy = $configuration_manager->getWorkingCopyIdentity(); | ||||
| if (!$working_copy) { | if (!$working_copy) { | ||||
| throw new Exception( | throw new Exception( | ||||
| pht( | pht( | ||||
| "Trying to create a RepositoryAPI without a working copy!")); | 'Trying to create a RepositoryAPI without a working copy!')); | ||||
| } | } | ||||
| $root = $working_copy->getProjectRoot(); | $root = $working_copy->getProjectRoot(); | ||||
| switch ($working_copy->getVCSType()) { | switch ($working_copy->getVCSType()) { | ||||
| case 'svn': | case 'svn': | ||||
| $api = new ArcanistSubversionAPI($root); | $api = new ArcanistSubversionAPI($root); | ||||
| break; | break; | ||||
| case 'hg': | case 'hg': | ||||
| $api = new ArcanistMercurialAPI($root); | $api = new ArcanistMercurialAPI($root); | ||||
| break; | break; | ||||
| case 'git': | case 'git': | ||||
| $api = new ArcanistGitAPI($root); | $api = new ArcanistGitAPI($root); | ||||
| break; | break; | ||||
| default: | default: | ||||
| throw new Exception( | throw new Exception( | ||||
| pht( | pht( | ||||
| "The current working directory is not part of a working copy for ". | 'The current working directory is not part of a working copy for '. | ||||
| "a supported version control system (Git, Subversion or ". | 'a supported version control system (Git, Subversion or '. | ||||
| "Mercurial).")); | 'Mercurial).')); | ||||
| } | } | ||||
| $api->configurationManager = $configuration_manager; | $api->configurationManager = $configuration_manager; | ||||
| return $api; | return $api; | ||||
| } | } | ||||
| public function __construct($path) { | public function __construct($path) { | ||||
| $this->path = $path; | $this->path = $path; | ||||
| ▲ Show 20 Lines • Show All 558 Lines • Show Last 20 Lines | |||||