evolve: improve error messages when conflicts occur
authorPulkit Goyal <7895pulkit@gmail.com>
Tue, 12 Jun 2018 19:00:12 +0530
changeset 3843 f0096db2a7b1
parent 3842 b293cce4ff55
child 3844 48fbccfd1dff
evolve: improve error messages when conflicts occur This patch improves the error messages when conflicts occur. First, we drop the line 'evolution failed', that is not the best line we can show and evolution didn't failed, it's just interrupted by the conflicts and when user will run `hg evolve --continue`, things will be fine. I still remember when I first saw 'evolution failed', I got a bit scare as am I in a recoverable position or not. So let's drop this scary line. Second, we replace the error messages to say `resolve conflicts and see help-topic`. The help topic was added recently and documents all the three flags very well. Addition of tests also showed that all the three flags works fine with all the three instability type. So we should advertise them more. Third, we now raise the error with our error message rather than raising MergeFailure and having evolution related text in hint or stderr above. This increase the focus on the error message we want to show. After this patch, I think error messages by evolve in case of conflicts will be same in every case.
hgext3rd/evolve/evolvecmd.py
tests/test-evolve-abort-orphan.t
tests/test-evolve-abort-phasediv.t
tests/test-evolve-continue.t
tests/test-evolve-orphan-merge.t
tests/test-evolve-phase-divergence.t
tests/test-evolve-phase.t
tests/test-evolve-stop-orphan.t
tests/test-evolve-stop-phasediv.t
tests/test-evolve.t
tests/test-issue-5720.t
tests/test-stabilize-conflict.t
tests/test-stabilize-result.t
--- a/hgext3rd/evolve/evolvecmd.py	Tue Jun 12 04:01:19 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Tue Jun 12 19:00:12 2018 +0530
@@ -180,9 +180,8 @@
             ops = {'current': orig.node()}
             evolvestate.addopts(ops)
             evolvestate.save()
-            repo.ui.write_err(_('evolve failed!\n'))
-            repo.ui.write_err(abortmessage)
-            raise
+            raise error.Abort(_("fix conflicts and see `hg help "
+                                "evolve.interrupted`"))
 
 def _solvephasedivergence(ui, repo, bumped, evolvestate, dryrun=False,
                           confirm=False, progresscb=None):
@@ -251,11 +250,8 @@
             evolvestate['current'] = bumped.hex()
             evolvestate['precursor'] = prec.hex()
             evolvestate.save()
-            repo.ui.write_err(_('evolution failed!\n'))
-            msg = _("fix conflict then run 'hg evolve --continue' or "
-                    "use `hg evolve --abort`\n")
-            repo.ui.write_err(msg)
-            raise
+            raise error.Abort(_("fix conflicts and see `hg help "
+                                "evolve.interrupted`"))
 
     return _resolvephasedivergent(ui, repo, prec, bumped, tmpctx)
 
--- a/tests/test-evolve-abort-orphan.t	Tue Jun 12 04:01:19 2018 +0530
+++ b/tests/test-evolve-abort-orphan.t	Tue Jun 12 19:00:12 2018 +0530
@@ -85,9 +85,7 @@
   atop:[5] added c
   merging d
   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ hg evolve --abort
@@ -119,9 +117,7 @@
   atop:[5] added c
   merging d
   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
   $ echo foo > d
   $ hg resolve -m
@@ -149,9 +145,7 @@
   atop:[8] added b
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
 testing that interrupted evolve shows up in morestatus
@@ -262,9 +256,7 @@
   atop:[7] added a
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ hg glog
@@ -328,9 +320,7 @@
   atop:[7] added a
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
   $ hg glog
   o  9:7f8e8bd9f0b6 added c
@@ -407,9 +397,7 @@
   atop:[7] added a
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ hg glog
@@ -485,9 +473,7 @@
   atop:[5] added b
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ hg glog
@@ -533,9 +519,7 @@
   atop:[5] added b
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ hg evolve --abort
--- a/tests/test-evolve-abort-phasediv.t	Tue Jun 12 04:01:19 2018 +0530
+++ b/tests/test-evolve-abort-phasediv.t	Tue Jun 12 19:00:12 2018 +0530
@@ -87,9 +87,7 @@
   rebasing to destination parent: ca1b80f7960a
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  evolution failed!
-  fix conflict then run 'hg evolve --continue' or use `hg evolve --abort`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
 testing that interrupted evolve shows up in morestatus
@@ -201,9 +199,7 @@
   rebasing to destination parent: b1661037fa25
   merging b
   warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
-  evolution failed!
-  fix conflict then run 'hg evolve --continue' or use `hg evolve --abort`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ hg evolve --abort
@@ -272,9 +268,7 @@
   rebasing to destination parent: b1661037fa25
   merging b
   warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
-  evolution failed!
-  fix conflict then run 'hg evolve --continue' or use `hg evolve --abort`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ echo watwat > c
@@ -290,9 +284,7 @@
   rebasing to destination parent: ca1b80f7960a
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  evolution failed!
-  fix conflict then run 'hg evolve --continue' or use `hg evolve --abort`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ hg evolve --abort
--- a/tests/test-evolve-continue.t	Tue Jun 12 04:01:19 2018 +0530
+++ b/tests/test-evolve-continue.t	Tue Jun 12 19:00:12 2018 +0530
@@ -58,9 +58,7 @@
   atop:[5] added c
   merging d
   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ echo foo > d
@@ -117,9 +115,7 @@
   atop:[8] added d
   merging e
   warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ echo bar > e
@@ -158,9 +154,7 @@
   atop:[9] added a
   merging b
   warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ echo foo > b
@@ -246,9 +240,7 @@
   atop:[17] added d
   merging f
   warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ echo foo > f
@@ -263,9 +255,7 @@
   atop:[19] added g
   merging h
   warning: conflicts while merging h! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ echo foo > h
@@ -311,9 +301,7 @@
   perform evolve? [Ny] y
   merging g
   warning: conflicts while merging g! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ echo foo > g
@@ -363,9 +351,7 @@
   atop:[24] added f
   merging g
   warning: conflicts while merging g! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
   $ echo foo > g
   $ hg resolve -m
--- a/tests/test-evolve-orphan-merge.t	Tue Jun 12 04:01:19 2018 +0530
+++ b/tests/test-evolve-orphan-merge.t	Tue Jun 12 19:00:12 2018 +0530
@@ -219,9 +219,7 @@
   atop:[11] foo to c
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ echo FOObar > c
@@ -276,9 +274,7 @@
   atop:[13] foo to c
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ echo foobar > c
--- a/tests/test-evolve-phase-divergence.t	Tue Jun 12 04:01:19 2018 +0530
+++ b/tests/test-evolve-phase-divergence.t	Tue Jun 12 19:00:12 2018 +0530
@@ -792,9 +792,7 @@
   rebasing to destination parent: 8c2bb6fb44e9
   merging x
   warning: conflicts while merging x! (edit, then use 'hg resolve --mark')
-  evolution failed!
-  fix conflict then run 'hg evolve --continue' or use `hg evolve --abort`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ hg diff
--- a/tests/test-evolve-phase.t	Tue Jun 12 04:01:19 2018 +0530
+++ b/tests/test-evolve-phase.t	Tue Jun 12 19:00:12 2018 +0530
@@ -86,9 +86,7 @@
   atop:[3] b
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ hg diff
--- a/tests/test-evolve-stop-orphan.t	Tue Jun 12 04:01:19 2018 +0530
+++ b/tests/test-evolve-stop-orphan.t	Tue Jun 12 19:00:12 2018 +0530
@@ -90,9 +90,7 @@
   atop:[5] added c
   merging d
   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ hg evolve --stop
@@ -138,9 +136,7 @@
   atop:[5] added c
   merging d
   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ hg diff
@@ -187,9 +183,7 @@
   atop:[5] added c
   merging d
   warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
   $ echo foo > d
   $ hg resolve -m
@@ -240,9 +234,7 @@
   atop:[9] added b
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ hg status
@@ -279,9 +271,7 @@
   atop:[9] added b
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ echo foobar > c
@@ -357,9 +347,7 @@
   atop:[13] added b
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ hg evolve --stop
--- a/tests/test-evolve-stop-phasediv.t	Tue Jun 12 04:01:19 2018 +0530
+++ b/tests/test-evolve-stop-phasediv.t	Tue Jun 12 19:00:12 2018 +0530
@@ -84,9 +84,7 @@
   rebasing to destination parent: ca1b80f7960a
   merging c
   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
-  evolution failed!
-  fix conflict then run 'hg evolve --continue' or use `hg evolve --abort`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ hg evolve --stop
--- a/tests/test-evolve.t	Tue Jun 12 04:01:19 2018 +0530
+++ b/tests/test-evolve.t	Tue Jun 12 19:00:12 2018 +0530
@@ -1535,9 +1535,7 @@
   atop:[38] will be evolved safely
   merging newfile
   warning: conflicts while merging newfile! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
   $ glog -r "be23044af550::" --hidden
--- a/tests/test-issue-5720.t	Tue Jun 12 04:01:19 2018 +0530
+++ b/tests/test-issue-5720.t	Tue Jun 12 19:00:12 2018 +0530
@@ -61,9 +61,7 @@
   atop:[3] b
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
 
 Fix the conflict
--- a/tests/test-stabilize-conflict.t	Tue Jun 12 04:01:19 2018 +0530
+++ b/tests/test-stabilize-conflict.t	Tue Jun 12 19:00:12 2018 +0530
@@ -128,9 +128,7 @@
   atop:[5] babar count up to ten
   merging babar
   warning: conflicts while merging babar! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
   $ hg resolve -l
   U babar
@@ -222,9 +220,7 @@
    output file babar appears unchanged
   was merge successful (yn)? n
   merging babar failed!
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
   $ hg resolve -l
   U babar
--- a/tests/test-stabilize-result.t	Tue Jun 12 04:01:19 2018 +0530
+++ b/tests/test-stabilize-result.t	Tue Jun 12 19:00:12 2018 +0530
@@ -81,9 +81,7 @@
   atop:[5] changea
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
-  evolve failed!
-  see `hg help evolve.interrupted`
-  abort: unresolved merge conflicts (see hg help resolve)
+  abort: fix conflicts and see `hg help evolve.interrupted`
   [255]
   $ hg revert -r "orphan()" a
   $ hg diff