From 9c349f24c13494da33f76dfed4f8a26f1700fce6 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Fri, 13 Apr 2012 22:14:10 +0200 Subject: [PATCH] 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 --- git-review | 2 +- git-review.1 | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/git-review b/git-review index ac0d1ed..dc695d4 100755 --- a/git-review +++ b/git-review @@ -499,7 +499,7 @@ def download_review(review, masterbranch, remote): checkout_cmd = "git checkout -b %s FETCH_HEAD" % branch_name (status, output) = run_command_status(checkout_cmd) if status != 0: - if output.endswith("already exists"): + if re.search("already exists\.?", output): print "Branch already exists - reusing" checkout_cmd = "git checkout %s" % branch_name (status, output) = run_command_status(checkout_cmd) diff --git a/git-review.1 b/git-review.1 index f0de17a..4a0b2ee 100644 --- a/git-review.1 +++ b/git-review.1 @@ -38,6 +38,7 @@ Download .Ar change from Gerrit 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 Close down the local branch and switch back to the target branch on successful submission.