Changeset View
Changeset View
Standalone View
Standalone View
src/repository/api/ArcanistRepositoryAPI.php
| Show First 20 Lines • Show All 398 Lines • ▼ Show 20 Lines | public function execManualLocal($pattern /* , ... */) { | ||||
| return $this->buildLocalFuture($args)->resolve(); | return $this->buildLocalFuture($args)->resolve(); | ||||
| } | } | ||||
| public function execFutureLocal($pattern /* , ... */) { | public function execFutureLocal($pattern /* , ... */) { | ||||
| $args = func_get_args(); | $args = func_get_args(); | ||||
| return $this->buildLocalFuture($args); | return $this->buildLocalFuture($args); | ||||
| } | } | ||||
| abstract protected function buildLocalFuture(array $argv); | /** | ||||
| * Provide the name of the VCS binary, like `'git'`, `'hg'` or `'svn'`. | |||||
| * | |||||
| * @return string Name of the VCS binary. | |||||
| */ | |||||
| abstract protected function getBinaryName(); | |||||
| /** | |||||
| * Provide environmental variables specific to this VCS. | |||||
| * | |||||
| * These variables will be passed to VCS subprocesses. For example, Mercurial | |||||
| * needs to execute with HGPLAIN. | |||||
| * | |||||
| * @return map<string, string> Map of environmental variables to pass to | |||||
| * VCS subprocesses. | |||||
| */ | |||||
| protected function getExecutionEnvironment() { | |||||
| return array(); | |||||
| } | |||||
| final protected function getCommonExecutionEnvironment() { | |||||
| return array( | |||||
| 'LC_ALL' => 'en_US.UTF-8', | |||||
| ); | |||||
| } | |||||
| protected function buildLocalFuture(array $argv) { | |||||
| list($command, $env) = $this->formatVCSCommand($argv); | |||||
| return id(new ExecFuture('%C', $command)) | |||||
| ->setEnv($env) | |||||
| ->setCWD($this->getPath()); | |||||
| } | |||||
| public function execPassthru($pattern /* , ... */) { | |||||
| $argv = func_get_args(); | |||||
| list($command, $env) = $this->formatVCSCommand($argv); | |||||
| return id(new PhutilExecPassthru('%C', $command)) | |||||
| ->setEnv($env) | |||||
| ->setCWD($this->getPath()); | |||||
| } | |||||
| private function formatVCSCommand(array $argv) { | |||||
| $argv = call_user_func_array('csprintf', $argv); | |||||
| $command = csprintf('%s %C', $this->getBinaryName(), $argv); | |||||
| $env = $this->getExecutionEnvironment() + | |||||
| $this->getCommonExecutionEnvironment(); | |||||
| return array($command, $env); | |||||
| } | |||||
| public function canStashChanges() { | public function canStashChanges() { | ||||
| return false; | return false; | ||||
| } | } | ||||
| public function stashChanges() { | public function stashChanges() { | ||||
| throw new ArcanistCapabilityNotSupportedException($this); | throw new ArcanistCapabilityNotSupportedException($this); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 244 Lines • Show Last 20 Lines | |||||