fix -d not reusing already existing local branch
For sometime now, git-review -d would bail out with a fatal error whenever a local branch already exists. The cause is that the output message sent by `git checkout -b` has changed and ends with a dot on certain git version, that skip a condition in git-review code. git version 1.7.9.4 Patchset 2: Fix nitpicks Change-Id: I86ce9b577eff185e2cdd3b4dfa8dc31b110b0f13
This commit is contained in:
@@ -499,7 +499,7 @@ def download_review(review, masterbranch, remote):
|
|||||||
checkout_cmd = "git checkout -b %s FETCH_HEAD" % branch_name
|
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 re.search("already exists\.?", output):
|
||||||
print "Branch already exists - reusing"
|
print "Branch already exists - reusing"
|
||||||
checkout_cmd = "git checkout %s" % branch_name
|
checkout_cmd = "git checkout %s" % branch_name
|
||||||
(status, output) = run_command_status(checkout_cmd)
|
(status, output) = run_command_status(checkout_cmd)
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ Download
|
|||||||
.Ar change
|
.Ar change
|
||||||
from Gerrit
|
from Gerrit
|
||||||
into a local branch. The branch will be named after the patch author and the name of a topic.
|
into a local branch. The branch will be named after the patch author and the name of a topic.
|
||||||
|
If the local branch already exists, it will attempt to update with the latest patchset for this change.
|
||||||
.It Fl f , Fl -finish
|
.It Fl f , Fl -finish
|
||||||
Close down the local branch and switch back to the target branch on
|
Close down the local branch and switch back to the target branch on
|
||||||
successful submission.
|
successful submission.
|
||||||
|
|||||||
Reference in New Issue
Block a user