1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 14:52:40 +01:00

Switch back to former branch after landing some other branch

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 commit is contained in:
epriestley 2012-02-03 15:44:59 -08:00
parent a83983fe81
commit aad56eca6a

View file

@ -109,6 +109,8 @@ EOTEXT
$this->requireCleanWorkingCopy();
$repository_api->parseRelativeLocalCommit(array($remote.'/'.$onto));
$old_branch = $repository_api->getBranchName();
execx(
'(cd %s && git checkout %s)',
$repository_api->getPath(),
@ -284,6 +286,18 @@ EOTEXT
$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;