Changeset View
Changeset View
Standalone View
Standalone View
src/land/engine/ArcanistMercurialLandEngine.php
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | if ($branch !== null) { | ||||
pht( | pht( | ||||
'Landing the active branch, "%s".', | 'Landing the active branch, "%s".', | ||||
$branch)); | $branch)); | ||||
return array($branch); | return array($branch); | ||||
} | } | ||||
$commit = $api->getCanonicalRevisionName('.'); | $commit = $api->getCanonicalRevisionName('.'); | ||||
$commit = $this->getDisplayHash($commit); | |||||
$log->writeStatus( | $log->writeStatus( | ||||
pht('SOURCE'), | pht('SOURCE'), | ||||
pht( | pht( | ||||
'Landing the active commit, "%s".', | 'Landing the active commit, "%s".', | ||||
$this->getDisplayHash($commit))); | $this->getDisplayHash($commit))); | ||||
return array($commit); | return array($commit); | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | foreach ($unresolved as $symbol) { | ||||
} | } | ||||
$symbol->setCommit($commit); | $symbol->setCommit($commit); | ||||
} | } | ||||
} | } | ||||
protected function selectOntoRemote(array $symbols) { | protected function selectOntoRemote(array $symbols) { | ||||
assert_instances_of($symbols, 'ArcanistLandSymbol'); | assert_instances_of($symbols, 'ArcanistLandSymbol'); | ||||
$api = $this->getRepositoryAPI(); | |||||
$remote = $this->newOntoRemote($symbols); | $remote = $this->newOntoRemote($symbols); | ||||
// TODO: Verify this remote actually exists. | $remote_ref = $api->newRemoteRefQuery() | ||||
->withNames(array($remote)) | |||||
->executeOne(); | |||||
if (!$remote_ref) { | |||||
throw new PhutilArgumentUsageException( | |||||
pht( | |||||
'No remote "%s" exists in this repository.', | |||||
$remote)); | |||||
} | |||||
// TODO: Allow selection of a bare URI. | |||||
return $remote; | return $remote; | ||||
} | } | ||||
private function newOntoRemote(array $symbols) { | private function newOntoRemote(array $symbols) { | ||||
assert_instances_of($symbols, 'ArcanistLandSymbol'); | assert_instances_of($symbols, 'ArcanistLandSymbol'); | ||||
$api = $this->getRepositoryAPI(); | $api = $this->getRepositoryAPI(); | ||||
$log = $this->getLogEngine(); | $log = $this->getLogEngine(); | ||||
▲ Show 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | if ($this->getIntoLocalArgument()) { | ||||
'flag.')); | 'flag.')); | ||||
return; | return; | ||||
} | } | ||||
$into = $this->getIntoRemoteArgument(); | $into = $this->getIntoRemoteArgument(); | ||||
if ($into !== null) { | if ($into !== null) { | ||||
// TODO: Verify that this is a valid path. | $remote_ref = $api->newRemoteRefQuery() | ||||
// TODO: Allow a raw URI? | ->withNames(array($into)) | ||||
->executeOne(); | |||||
if (!$remote_ref) { | |||||
throw new PhutilArgumentUsageException( | |||||
pht( | |||||
'No remote "%s" exists in this repository.', | |||||
$into)); | |||||
} | |||||
// TODO: Allow a raw URI. | |||||
$this->setIntoRemote($into); | $this->setIntoRemote($into); | ||||
$log->writeStatus( | $log->writeStatus( | ||||
pht('INTO REMOTE'), | pht('INTO REMOTE'), | ||||
pht( | pht( | ||||
'Will merge into remote "%s", selected with the "--into" flag.', | 'Will merge into remote "%s", selected with the "--into" flag.', | ||||
$into)); | $into)); | ||||
▲ Show 20 Lines • Show All 438 Lines • Show Last 20 Lines |