mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-29 18:22:41 +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:
parent
a83983fe81
commit
aad56eca6a
1 changed files with 14 additions and 0 deletions
|
@ -109,6 +109,8 @@ EOTEXT
|
||||||
$this->requireCleanWorkingCopy();
|
$this->requireCleanWorkingCopy();
|
||||||
$repository_api->parseRelativeLocalCommit(array($remote.'/'.$onto));
|
$repository_api->parseRelativeLocalCommit(array($remote.'/'.$onto));
|
||||||
|
|
||||||
|
$old_branch = $repository_api->getBranchName();
|
||||||
|
|
||||||
execx(
|
execx(
|
||||||
'(cd %s && git checkout %s)',
|
'(cd %s && git checkout %s)',
|
||||||
$repository_api->getPath(),
|
$repository_api->getPath(),
|
||||||
|
@ -284,6 +286,18 @@ EOTEXT
|
||||||
$branch);
|
$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";
|
echo "Done.\n";
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue