Added support for fixing existing gerrit remotes.

Change-Id: I10fa832c1a7216df67ce647a7ff98ffd14cd55d5
This commit is contained in:
Monty Taylor 2011-10-11 16:12:28 -07:00
parent afd7ee871c
commit a698b900a9

View File

@ -244,7 +244,23 @@ def check_remote(remote):
def rebase_changes(branch, remote):
cmd = "GIT_EDITOR=true git rebase -i %s/%s" % (remote, branch)
remote_branch = "remotes/%s/%s" % (remote, branch)
needs_remote = True
for current_remote in run_command("git branch -a").split("\n"):
if current_remote.strip() == remote_branch:
needs_remote = False
if needs_remote:
cmd = "git remote update %s" % remote
(status, output) = run_command_status(cmd)
if VERBOSE:
print output
if status != 0:
print "Problem running '%s'" % cmd
if not VERBOSE:
print output
return False
cmd = "GIT_EDITOR=true git rebase -i %s" % remote_branch
(status, output) = run_command_status(cmd)
if status != 0:
print "Errors running %s" % cmd