diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php --- a/src/repository/api/ArcanistGitAPI.php +++ b/src/repository/api/ArcanistGitAPI.php @@ -1181,26 +1181,6 @@ return $parser->parseDiff($diff); } - public function supportsLocalBranchMerge() { - return true; - } - - public function performLocalBranchMerge($branch, $message) { - if (!$branch) { - throw new ArcanistUsageException( - pht('Under git, you must specify the branch you want to merge.')); - } - $err = phutil_passthru( - '(cd %s && git merge --no-ff -m %s %s)', - $this->getPath(), - $message, - $branch); - - if ($err) { - throw new ArcanistUsageException(pht('Merge failed!')); - } - } - public function getFinalizedRevisionMessage() { return pht( "You may now push this commit upstream, as appropriate (e.g. with ". diff --git a/src/repository/api/ArcanistMercurialAPI.php b/src/repository/api/ArcanistMercurialAPI.php --- a/src/repository/api/ArcanistMercurialAPI.php +++ b/src/repository/api/ArcanistMercurialAPI.php @@ -13,36 +13,29 @@ private $supportsPhases; protected function buildLocalFuture(array $argv) { - // Mercurial has a "defaults" feature which basically breaks automation by - // allowing the user to add random flags to any command. This feature is - // "deprecated" and "a bad idea" that you should "forget ... existed" - // according to project lead Matt Mackall: - // - // http://markmail.org/message/hl3d6eprubmkkqh5 - // - // There is an HGPLAIN environmental variable which enables "plain mode" - // and hopefully disables this stuff. + $env = $this->getMercurialEnvironmentVariables(); - if (phutil_is_windows()) { - $argv[0] = 'set HGPLAIN=1 & hg '.$argv[0]; - } else { - $argv[0] = 'HGPLAIN=1 hg '.$argv[0]; - } + $argv[0] = 'hg '.$argv[0]; + + $future = newv('ExecFuture', $argv) + ->setEnv($env) + ->setCWD($this->getPath()); - $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); + $env = $this->getMercurialEnvironmentVariables(); + + $args[0] = 'hg '.$args[0]; + + $passthru = newv('PhutilExecPassthru', $args) + ->setEnv($env) + ->setCWD($this->getPath()); + + return $passthru->resolve(); } public function getSourceControlSystemName() { @@ -616,29 +609,6 @@ return $parser->parseDiff($diff); } - public function supportsLocalBranchMerge() { - return true; - } - - public function performLocalBranchMerge($branch, $message) { - if ($branch) { - $err = phutil_passthru( - '(cd %s && HGPLAIN=1 hg merge --rev %s && hg commit -m %s)', - $this->getPath(), - $branch, - $message); - } else { - $err = phutil_passthru( - '(cd %s && HGPLAIN=1 hg merge && hg commit -m %s)', - $this->getPath(), - $message); - } - - if ($err) { - throw new ArcanistUsageException(pht('Merge failed!')); - } - } - public function getFinalizedRevisionMessage() { return pht( "You may now push this commit upstream, as appropriate (e.g. with ". @@ -1133,4 +1103,22 @@ return null; } + private function getMercurialEnvironmentVariables() { + $env = array(); + + // Mercurial has a "defaults" feature which basically breaks automation by + // allowing the user to add random flags to any command. This feature is + // "deprecated" and "a bad idea" that you should "forget ... existed" + // according to project lead Matt Mackall: + // + // http://markmail.org/message/hl3d6eprubmkkqh5 + // + // There is an HGPLAIN environmental variable which enables "plain mode" + // and hopefully disables this stuff. + + $env['HGPLAIN'] = 1; + + return $env; + } + } diff --git a/src/repository/api/ArcanistRepositoryAPI.php b/src/repository/api/ArcanistRepositoryAPI.php --- a/src/repository/api/ArcanistRepositoryAPI.php +++ b/src/repository/api/ArcanistRepositoryAPI.php @@ -394,12 +394,6 @@ throw new ArcanistCapabilityNotSupportedException($this); } - abstract public function supportsLocalBranchMerge(); - - public function performLocalBranchMerge($branch, $message) { - throw new ArcanistCapabilityNotSupportedException($this); - } - public function getFinalizedRevisionMessage() { throw new ArcanistCapabilityNotSupportedException($this); } diff --git a/src/repository/api/ArcanistSubversionAPI.php b/src/repository/api/ArcanistSubversionAPI.php --- a/src/repository/api/ArcanistSubversionAPI.php +++ b/src/repository/api/ArcanistSubversionAPI.php @@ -634,10 +634,6 @@ return $this->getSourceControlBaseRevision(); } - public function supportsLocalBranchMerge() { - return false; - } - public function getFinalizedRevisionMessage() { // In other VCSes we give push instructions here, but it never makes sense // in SVN.