Commits

Anonymous committed bbb3a0e

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.

Comments (0)

Files changed (2)

 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
 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:'))