Browse Source

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
tags/1.0.0
James E. Blair 4 years ago
parent
commit
e64e500234
2 changed files with 9 additions and 0 deletions
  1. 7
    0
      git_review/cmd.py
  2. 2
    0
      git_review/tests/test_git_review.py

+ 7
- 0
git_review/cmd.py View File

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

+ 2
- 0
git_review/tests/test_git_review.py View File

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

Loading…
Cancel
Save