Support git 2.15 and newer
The 2.15 release of git drops support for `git branch --set-upstream` and replaces it with `git branch --set-upstream-to` which was added in git 1.8. Move from --set-upstream to --set-upstream-to in order to support git 2.15 and beyond. Note that this specifically affects the `git review -d` functionality as it is what needs to update the upstream. This does drop support for git 1.7 and older though as this option did not exist then. Polling linux distros and OS X the oldest git I can find is on CentOS 7 which has 1.8 so this should be fine. Story: 2001266 Co-Authored-By: Harry Mallon <Harry.Mallon@codex.online> Change-Id: I5ded1ab39bb2c76bdc38655299bac11b4584e138
This commit is contained in:
@@ -1227,11 +1227,11 @@ def checkout_review(branch_name, remote, remote_branch):
|
||||
run_command_exc(CheckoutNewBranchFailed,
|
||||
"git", "checkout", "-b",
|
||||
branch_name, "FETCH_HEAD")
|
||||
# --set-upstream-to is not supported in git 1.7
|
||||
# --set-upstream-to is supported starting in git 1.8
|
||||
run_command_exc(SetUpstreamBranchFailed,
|
||||
"git", "branch", "--set-upstream",
|
||||
branch_name,
|
||||
'%s/%s' % (remote, remote_branch))
|
||||
"git", "branch", "--set-upstream-to",
|
||||
'%s/%s' % (remote, remote_branch),
|
||||
branch_name)
|
||||
|
||||
except CheckoutNewBranchFailed as e:
|
||||
if re.search("already exists\.?", e.output):
|
||||
|
||||
Reference in New Issue
Block a user