evolve: add more details when we abort for case not handled yet
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 07 Jan 2014 15:52:47 -0800
changeset 760 bbb3a0e1dfea
parent 759 57874b249940
child 761 60a2fad03650
evolve: add more details when we abort for case not handled yet Verboser output to help people knowing what is going on and solving it on their own.
README
hgext/evolve.py
--- a/README	Tue Jan 07 17:03:36 2014 -0800
+++ b/README	Tue Jan 07 15:52:47 2014 -0800
@@ -42,6 +42,11 @@
 Changelog
 =========
 
+3.3.0 --
+
+- add verbose hint about how to handle corner case by hand.
+  This should help people until evolve is able to to it itself.
+
 3.2.0 -- 2013-11-15
 
 - conform to the Mercurial custom of lowercase messages
--- a/hgext/evolve.py	Tue Jan 07 17:03:36 2014 -0800
+++ b/hgext/evolve.py	Tue Jan 07 15:52:47 2014 -0800
@@ -1140,14 +1140,37 @@
 def _solvedivergent(ui, repo, divergent, dryrun=False):
     base, others = divergentdata(divergent)
     if len(others) > 1:
-        raise util.Abort("We do not handle split yet")
+        othersstr = "[%s]" % (','.join([str(i) for i in others]))
+        hint = ("changeset %d is divergent with a changeset that got splitted "
+                "| into multiple ones:\n[%s]\n"
+                "| This is not handled by automatic evolution yet\n"
+                "| You have to fallback to manual handling with commands as:\n"
+                "| - hg touch -D\n"
+                "| - hg prune\n"
+                "| \n"
+                "| You should contact your local evolution Guru for help.\n"
+                % (divergent, othersstr))
+        raise util.Abort("We do not handle divergence with split yet",
+                         hint='')
     other = others[0]
     if divergent.phase() <= phases.public:
-        raise util.Abort("We can't resolve this conflict from the public side")
+        raise util.Abort("We can't resolve this conflict from the public side",
+                         hint="%s is public, try from %s" % (divergent, other))
     if len(other.parents()) > 1:
-        raise util.Abort("divergent changeset can't be a merge (yet)")
+        raise util.Abort("divergent changeset can't be a merge (yet)",
+                          hint="You have to fallback to solving this by hand...\n"
+                               "| This probably mean to redo the merge and use "
+                               "| `hg prune` to kill older version.")
     if other.p1() not in divergent.parents():
-        raise util.Abort("parents are not common (not handled yet)")
+        raise util.Abort("parents are not common (not handled yet)",
+                         hint="| %(d)s, %(o)s are not based on the same changeset."
+                              "| With the current state of its implementation, "
+                              "| evolve does not work in that case.\n"
+                              "| rebase one of them next to the other and run "
+                              "| this command again.\n"
+                              "| - either: hg rebase -dest 'p1(%(d)s)' -r %(o)s"
+                              "| - or:     hg rebase -dest 'p1(%(d)s)' -r %(o)s"
+                              % {'d': divergent, 'o': other})
 
     displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
     ui.status(_('merge:'))