Provide an explanation on failed rebase

It is not clear why git-review might attempt a rebase and fail,
so provide a helpful error message with suggested next steps in
that case.

Co-Authored-By: Clark Boylan <clark.boylan@gmail.com>
Change-Id: I195554ed5c577c39687d9001a177dadf107bab61
This commit is contained in:
James E. Blair 2015-05-27 12:41:28 -07:00 committed by James E. Blair
parent f78f328b17
commit e64e500234
2 changed files with 9 additions and 0 deletions

View File

@ -789,6 +789,13 @@ def rebase_changes(branch, remote, interactive=True):
print("Errors running %s" % cmd)
if interactive:
print(output)
print("It is likely that your change has a merge conflict. "
"You may resolve it in the working tree now as "
"described above and then run 'git review' again, or "
"if you do not want to resolve it yet (note that the "
"change can not merge until the conflict is resolved) "
"you may run 'git rebase --abort' then 'git review -R' "
"to upload the change without rebasing.")
return False
return True

View File

@ -149,6 +149,8 @@ class GitReviewTestCase(tests.BaseGitReviewTestCase):
exc = self.assertRaises(Exception, self._run_git_review)
self.assertIn("Errors running git rebase -p -i remotes/gerrit/master",
exc.args[0])
self.assertIn("It is likely that your change has a merge conflict.",
exc.args[0])
def test_upload_without_rebase(self):
"""Test change not needing a rebase can upload without rebasing."""