Summary:
If you're on A and run "arc land B", run "git checkout A" after
everything's said and done.
Test Plan: Ran "arc land B" from A, got switched back to it.
Reviewers: davidreuss, kdeggelman, btrahan
Reviewed By: btrahan
CC: aran, epriestley
Differential Revision: https://secure.phabricator.com/D1568
$this->requireCleanWorkingCopy();
$repository_api->parseRelativeLocalCommit(array($remote.'/'.$onto));
+ $old_branch = $repository_api->getBranchName();
+
execx(
'(cd %s && git checkout %s)',
$repository_api->getPath(),
$branch);
}
+ // If we were on some branch A and the user ran "arc land B", switch back
+ // to A.
+ if (($old_branch != $branch) && ($old_branch != $onto)) {
+ execx(
+ '(cd %s && git checkout %s)',
+ $repository_api->getPath(),
+ $old_branch);
+ echo phutil_console_format(
+ "Switched back to branch **%s**.\n",
+ $old_branch);
+ }
+
echo "Done.\n";
return 0;