Changeset View
Changeset View
Standalone View
Standalone View
arcanist/workflow/ArcanistLandBotWorkflow.php
Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | if ($this->getArgument('preview')) { | ||||
// land the change. | // land the change. | ||||
array_push($landArgs, '--hold'); | array_push($landArgs, '--hold'); | ||||
} | } | ||||
// Checkout the specified branch/commit which will determine the revision | // Checkout the specified branch/commit which will determine the revision | ||||
// to land. Your old branch will be restored at the end. | // to land. Your old branch will be restored at the end. | ||||
$branch = $this->getArgument('branch'); | $branch = $this->getArgument('branch'); | ||||
if (!empty($branch)) { | if (!empty($branch)) { | ||||
$repositoryApi->execxLocal('checkout %s', $branch[0]); | $branch = $branch[0]; | ||||
$repositoryApi->execxLocal('checkout %s', $branch); | |||||
} | } | ||||
$revision = $this->getArgument('revision'); | $revision = $this->getArgument('revision'); | ||||
if (empty($revision)) { | if (empty($revision)) { | ||||
// By default, queue the latest revision on the current branch | // By default, queue the latest revision on the current branch | ||||
$revisions = $repositoryApi->loadWorkingCopyDifferentialRevisions( | $revisions = $repositoryApi->loadWorkingCopyDifferentialRevisions( | ||||
$this->getConduit(), array()); | $this->getConduit(), array()); | ||||
if (empty($revisions)) { | |||||
$location = 'current branch'; | |||||
if (!empty($branch)) { | |||||
// Restore the branch you were on previously | |||||
$repositoryApi->execxLocal('checkout %s', $oldBranch); | |||||
$location = "'$branch'"; | |||||
} | |||||
throw new ArcanistUsageException(pht( | |||||
"Error: Could not find a valid revision at %s", $location)); | |||||
} | |||||
$revision = 'D' . end($revisions)['id']; | $revision = 'D' . end($revisions)['id']; | ||||
} | } | ||||
array_push($landArgs, '--revision'); | array_push($landArgs, '--revision'); | ||||
array_push($landArgs, $revision); | array_push($landArgs, $revision); | ||||
if ($this->getArgument('preview')) { | if ($this->getArgument('preview')) { | ||||
// Restore the branch you were on previously | // Restore the branch you were on previously | ||||
$repositoryApi->execxLocal('checkout %s', $oldBranch); | $repositoryApi->execxLocal('checkout %s', $oldBranch); | ||||
▲ Show 20 Lines • Show All 81 Lines • Show Last 20 Lines |