From e64e50023442f2b0b831931edfd57ca2492d1e53 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Wed, 27 May 2015 12:41:28 -0700 Subject: [PATCH] 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 Change-Id: I195554ed5c577c39687d9001a177dadf107bab61 --- git_review/cmd.py | 7 +++++++ git_review/tests/test_git_review.py | 2 ++ 2 files changed, 9 insertions(+) diff --git a/git_review/cmd.py b/git_review/cmd.py index 2f631c5..12bd034 100755 --- a/git_review/cmd.py +++ b/git_review/cmd.py @@ -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 diff --git a/git_review/tests/test_git_review.py b/git_review/tests/test_git_review.py index 94bd39b..680c08d 100644 --- a/git_review/tests/test_git_review.py +++ b/git_review/tests/test_git_review.py @@ -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."""