Merge "Warn rather than fail if HEAD already exists on the remote"

This commit is contained in:
Zuul 2023-09-25 13:04:31 +00:00 committed by Gerrit Code Review
commit ccaf223642
1 changed files with 11 additions and 2 deletions

View File

@ -1016,9 +1016,18 @@ def assert_one_change(remote, branch, yes, have_hook):
"installed. Amending the commit to add a gerrit change id.")
run_command("git commit --amend", GIT_EDITOR='true')
elif output_lines == 0:
printwrap("No changes between HEAD and %s/%s. Submitting for review "
printwrap("The commit HEAD already exists on a branch on the remote. "
"If it already exists on %s/%s, then submitting for review "
"would be pointless." % (remote, branch))
sys.exit(1)
print("\n\n"
"Do you really want to submit this review?")
try:
yes_no = input("Type 'yes' to confirm, other to cancel: ")
except KeyboardInterrupt:
yes_no = "no"
if yes_no.lower().strip() != "yes":
print("Aborting.")
sys.exit(1)
elif output_lines > 1:
if not yes:
printwrap("You are about to submit multiple commits. This is "