Merge "Support git 2.15 and newer"

This commit is contained in:
Zuul 2017-11-15 04:32:14 +00:00 committed by Gerrit Code Review
commit ef47e1f553
3 changed files with 9 additions and 7 deletions

View File

@ -16,6 +16,8 @@ For assistance installing pacakges from ``pypi`` on your OS check out
For installation from source simply add ``git-review`` to your $PATH For installation from source simply add ``git-review`` to your $PATH
after installing the dependencies listed in requirements.txt after installing the dependencies listed in requirements.txt
.. note:: ``git-review`` requires git version 1.8 or greater.
Setup Setup
===== =====

View File

@ -1232,11 +1232,11 @@ def checkout_review(branch_name, remote, remote_branch):
run_command_exc(CheckoutNewBranchFailed, run_command_exc(CheckoutNewBranchFailed,
"git", "checkout", "-b", "git", "checkout", "-b",
branch_name, "FETCH_HEAD") 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, run_command_exc(SetUpstreamBranchFailed,
"git", "branch", "--set-upstream", "git", "branch", "--set-upstream-to",
branch_name, '%s/%s' % (remote, remote_branch),
'%s/%s' % (remote, remote_branch)) branch_name)
except CheckoutNewBranchFailed as e: except CheckoutNewBranchFailed as e:
if re.search("already exists\.?", e.output): if re.search("already exists\.?", e.output):

View File

@ -310,9 +310,9 @@ class GitReviewTestCase(tests.BaseGitReviewTestCase):
# track different branch than expected in changeset # track different branch than expected in changeset
branch = self._run_git('rev-parse', '--abbrev-ref', 'HEAD') branch = self._run_git('rev-parse', '--abbrev-ref', 'HEAD')
self._run_git('branch', self._run_git('branch',
'--set-upstream', '--set-upstream-to',
branch, 'remotes/origin/other',
'remotes/origin/other') branch)
self.assertRaises( self.assertRaises(
Exception, # cmd.BranchTrackingMismatch inside Exception, # cmd.BranchTrackingMismatch inside
self._run_git_review, '-d', change_id) self._run_git_review, '-d', change_id)