Merge "Fix "git-review -d" erases work directory if on the same branch as the change downloaded"

This commit is contained in:
Zuul 2021-01-20 18:41:02 +00:00 committed by Gerrit Code Review
commit 84264b9c88

View File

@ -1130,8 +1130,8 @@ class CheckoutExistingBranchFailed(CommandFailed):
EXIT_CODE = 65 EXIT_CODE = 65
class ResetHardFailed(CommandFailed): class ResetKeepFailed(CommandFailed):
"Failed to hard reset downloaded branch" "Failed to reset downloaded branch"
EXIT_CODE = 66 EXIT_CODE = 66
@ -1246,8 +1246,8 @@ def checkout_review(branch_name, remote, remote_branch):
raise BranchTrackingMismatch raise BranchTrackingMismatch
run_command_exc(CheckoutExistingBranchFailed, run_command_exc(CheckoutExistingBranchFailed,
"git", "checkout", branch_name) "git", "checkout", branch_name)
run_command_exc(ResetHardFailed, run_command_exc(ResetKeepFailed,
"git", "reset", "--hard", "FETCH_HEAD") "git", "reset", "--keep", "FETCH_HEAD")
else: else:
raise raise