Changeset View
Changeset View
Standalone View
Standalone View
src/repository/api/ArcanistMercurialAPI.php
| <?php | <?php | ||||
| /** | /** | ||||
| * Interfaces with the Mercurial working copies. | * Interfaces with the Mercurial working copies. | ||||
| */ | */ | ||||
| final class ArcanistMercurialAPI extends ArcanistRepositoryAPI { | final class ArcanistMercurialAPI extends ArcanistRepositoryAPI { | ||||
| private $branch; | private $branch; | ||||
| private $localCommitInfo; | private $localCommitInfo; | ||||
| private $rawDiffCache = array(); | private $rawDiffCache = array(); | ||||
| private $supportsRebase; | private $supportsRebase; | ||||
| private $supportsPhases; | private $supportsPhases; | ||||
| protected function buildLocalFuture(array $argv) { | protected function getBinaryName() { | ||||
| return 'hg'; | |||||
| } | |||||
| protected function getExecutionEnvironment() { | |||||
| // Mercurial has a "defaults" feature which basically breaks automation by | // Mercurial has a "defaults" feature which basically breaks automation by | ||||
| // allowing the user to add random flags to any command. This feature is | // allowing the user to add random flags to any command. This feature is | ||||
| // "deprecated" and "a bad idea" that you should "forget ... existed" | // "deprecated" and "a bad idea" that you should "forget ... existed" | ||||
| // according to project lead Matt Mackall: | // according to project lead Matt Mackall: | ||||
| // | // | ||||
| // http://markmail.org/message/hl3d6eprubmkkqh5 | // http://markmail.org/message/hl3d6eprubmkkqh5 | ||||
| // | // | ||||
| // There is an HGPLAIN environmental variable which enables "plain mode" | // There is an HGPLAIN environmental variable which enables "plain mode" | ||||
| // and hopefully disables this stuff. | // and hopefully disables this stuff. | ||||
| if (phutil_is_windows()) { | return array( | ||||
| $argv[0] = 'set HGPLAIN=1 & hg '.$argv[0]; | 'HGPLAIN' => 1, | ||||
| } else { | ); | ||||
| $argv[0] = 'HGPLAIN=1 hg '.$argv[0]; | |||||
| } | |||||
| $future = newv('ExecFuture', $argv); | |||||
| $future->setCWD($this->getPath()); | |||||
| return $future; | |||||
| } | |||||
| public function execPassthru($pattern /* , ... */) { | |||||
| $args = func_get_args(); | |||||
| if (phutil_is_windows()) { | |||||
| $args[0] = 'hg '.$args[0]; | |||||
| } else { | |||||
| $args[0] = 'HGPLAIN=1 hg '.$args[0]; | |||||
| } | |||||
| return call_user_func_array('phutil_passthru', $args); | |||||
| } | } | ||||
| public function getSourceControlSystemName() { | public function getSourceControlSystemName() { | ||||
| return 'hg'; | return 'hg'; | ||||
| } | } | ||||
| public function getMetadataPath() { | public function getMetadataPath() { | ||||
| return $this->getPath('.hg'); | return $this->getPath('.hg'); | ||||
| ▲ Show 20 Lines • Show All 1,037 Lines • Show Last 20 Lines | |||||