Changeset View
Changeset View
Standalone View
Standalone View
src/land/engine/ArcanistMercurialLandEngine.php
Show First 20 Lines • Show All 449 Lines • ▼ Show 20 Lines | private function fetchTarget(ArcanistLandTarget $target) { | ||||
// branch, a bookmark, or a symbol which doesn't exist yet. | // branch, a bookmark, or a symbol which doesn't exist yet. | ||||
// In native Mercurial it is difficult to figure this out, so we use | // In native Mercurial it is difficult to figure this out, so we use | ||||
// an extension to provide a command which works like "git ls-remote". | // an extension to provide a command which works like "git ls-remote". | ||||
// NOTE: We're using passthru on this because it's a remote command and | // NOTE: We're using passthru on this because it's a remote command and | ||||
// may prompt the user for credentials. | // may prompt the user for credentials. | ||||
// TODO: This is fairly silly/confusing to show to users in the common | |||||
// case where it does not require credentials, particularly because the | |||||
// actual command line is full of nonsense. | |||||
$tmpfile = new TempFile(); | $tmpfile = new TempFile(); | ||||
Filesystem::remove($tmpfile); | Filesystem::remove($tmpfile); | ||||
$err = $this->newPassthru( | $command = $this->newPassthruCommand( | ||||
'%Ls arc-ls-remote --output %s -- %s', | '%Ls arc-ls-remote --output %s -- %s', | ||||
$api->getMercurialExtensionArguments(), | $api->getMercurialExtensionArguments(), | ||||
phutil_string_cast($tmpfile), | phutil_string_cast($tmpfile), | ||||
$target->getRemote()); | $target->getRemote()); | ||||
$command->setDisplayCommand( | |||||
'hg ls-remote -- %s', | |||||
$target->getRemote()); | |||||
$err = $command->execute(); | |||||
if ($err) { | if ($err) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Call to "hg arc-ls-remote" failed with error "%s".', | 'Call to "hg arc-ls-remote" failed with error "%s".', | ||||
$err)); | $err)); | ||||
} | } | ||||
$raw_data = Filesystem::readFile($tmpfile); | $raw_data = Filesystem::readFile($tmpfile); | ||||
▲ Show 20 Lines • Show All 395 Lines • Show Last 20 Lines |