Don't rebase if the rebase doesn't conflict
Change-Id: I549b6c8bf4355d4bb968d9006f71afa7803c7d8f
This commit is contained in:
parent
79c3403c9f
commit
976f4e4485
15
git-review
15
git-review
@ -372,6 +372,16 @@ def rebase_changes(branch, remote):
|
||||
return True
|
||||
|
||||
|
||||
def undo_rebase():
|
||||
cmd = "git reset --hard ORIG_HEAD"
|
||||
(status, output) = run_command_status(cmd)
|
||||
if status != 0:
|
||||
print("Errors running %s" % cmd)
|
||||
print(output)
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def get_branch_name(target_branch):
|
||||
global _branch_name
|
||||
if _branch_name is not None:
|
||||
@ -650,6 +660,9 @@ def main():
|
||||
parser.add_argument("-R", "--no-rebase", dest="rebase",
|
||||
action="store_false",
|
||||
help="Don't rebase changes before submitting.")
|
||||
parser.add_argument("-F", "--force-rebase", dest="force_rebase",
|
||||
action="store_true",
|
||||
help="Force rebase even when not needed.")
|
||||
parser.add_argument("-d", "--download", dest="download",
|
||||
help="Download the contents of an existing gerrit "
|
||||
"review into a branch")
|
||||
@ -727,6 +740,8 @@ def main():
|
||||
if options.rebase:
|
||||
if not rebase_changes(branch, remote):
|
||||
print_exit_message(1, needs_update)
|
||||
if not options.force_rebase and not undo_rebase():
|
||||
print_exit_message(1, needs_update)
|
||||
assert_one_change(remote, branch, yes, have_hook)
|
||||
|
||||
ref = "publish"
|
||||
|
Loading…
Reference in New Issue
Block a user