Use fetch/checkout instead of pull.

Fixes bug 897871. Using pull can sometimes cause a merge.
Instead, we should fetch the change and then check that out.

Change-Id: I255d2fd8bc065105f9a5cf37f3520295c660c104
This commit is contained in:
Monty Taylor
2011-11-29 13:14:09 -08:00
parent 9d1f225b5c
commit d1715ba387

View File

@@ -446,7 +446,12 @@ def download_review(review):
refspec = review_info['currentPatchSet']['ref'] refspec = review_info['currentPatchSet']['ref']
print "Downloading %s from gerrit into %s" % (refspec, branch_name) print "Downloading %s from gerrit into %s" % (refspec, branch_name)
checkout_cmd = "git checkout -b %s remotes/gerrit/master" % branch_name (status, output) = run_command_status("git fetch gerrit %s" % refspec)
if status != 0:
print output
return status
checkout_cmd = "git checkout -b %s FETCH_HEAD" % branch_name
(status, output) = run_command_status(checkout_cmd) (status, output) = run_command_status(checkout_cmd)
if status != 0: if status != 0:
if output.endswith("already exists"): if output.endswith("already exists"):
@@ -456,19 +461,15 @@ def download_review(review):
if status != 0: if status != 0:
print output print output
return status return status
reset_cmd = "git reset --hard FETCH_HEAD"
(status, output) = run_command_status(reset_cmd)
if status != 0:
print output
return status
else: else:
print output print output
return status return status
(status, output) = run_command_status("git pull gerrit %s" % refspec)
if status != 0:
print output
return status
(status, output) = run_command_status("git reset --hard %s" % revision)
if status != 0:
print output
return status
return 0 return 0