changeset 1412:8794a4680bdd

evolve: warn about every skipped evolution When we could not evolve a revision, we used to silently ignore it. We now inform the user that we ignored something and tell him why (with more or less informative message).
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 19 Jun 2015 17:35:29 -0700
parents 64515965c0df
children cf043c659ae3
files hgext/evolve.py tests/test-evolve-order.t
diffstat 2 files changed, 50 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py	Fri Jun 19 17:03:40 2015 -0700
+++ b/hgext/evolve.py	Fri Jun 19 17:35:29 2015 -0700
@@ -1409,8 +1409,10 @@
             dependencies[dependent].remove(rev)
             if not dependencies[dependent]:
                 solvablerevs.append(dependent)
+        del dependencies[rev]
         ordering.append(rev)
 
+    ordering.extend(sorted(dependencies))
     return ordering
 
 @command('^evolve|stabilize|solve',
@@ -1609,11 +1611,14 @@
         obs = obs.parents()[0]
         newer = obsolete.successorssets(repo, obs.node())
     if len(newer) > 1:
-        raise util.Abort(_("conflict rewriting. can't choose destination\n"))
+        msg = _("skipping %s: divergent rewriting. can't choose destination\n" % obs)
+        ui.write_err(msg)
+        return 2
     targets = newer[0]
     assert targets
     if len(targets) > 1:
-        raise util.Abort(_("does not handle split parents yet\n"))
+        msg = _("does not handle split parents yet\n")
+        ui.write_err(msg)
         return 2
     target = targets[0]
     displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
@@ -1650,13 +1655,15 @@
     bumped = repo[bumped.rev()]
     # For now we deny bumped merge
     if len(bumped.parents()) > 1:
-        raise util.Abort('late comer stabilization is confused by bumped'
-                         ' %s being a merge' % bumped)
+        msg = _('skipping %s : we do not handle merge yet\n' % bumped)
+        ui.write_err(msg)
+        return 2
     prec = repo.set('last(allprecursors(%d) and public())', bumped).next()
     # For now we deny target merge
     if len(prec.parents()) > 1:
-        raise util.Abort('late comer evolution is confused by precursors'
-                         ' %s being a merge' % prec)
+        msg = _('skipping: %s: public version is a merge, this not handled yet\n' % prec)
+        ui.write_err(msg)
+        return 2
 
     displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
     if not ui.quiet or confirm:
@@ -1759,37 +1766,46 @@
     base, others = divergentdata(divergent)
     if len(others) > 1:
         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 "
-                "such 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=hint)
+        msg = _("skipping %d: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 "
+                 "such as:\n"
+                 "| - hg touch -D\n"
+                 "| - hg prune\n"
+                 "| \n"
+                 "| You should contact your local evolution Guru for help.\n"
+                 % (divergent, othersstr))
+        ui.write_err(msg)
+        return 2
     other = others[0]
     if divergent.phase() <= phases.public:
-        raise util.Abort("we can't resolve this conflict from the public side",
-                    hint="%s is public, try from %s" % (divergent, other))
+        msg = _("skipping %s: we can't resolve divergence from the public side\n") % divergent
+        ui.write_err(msg)
+        hint = _("(%s is public, try from %s)\n" % (divergent, other))
+        ui.write_err(hint)
+        return 2
     if len(other.parents()) > 1:
-        raise util.Abort("divergent changeset can't be a merge (yet)",
-                    hint="You have to fallback to solving this by hand...\n"
-                         "| This probably means redoing the merge and using "
-                         "| `hg prune` to kill older version.")
+        msg = _("skipping %s: divergent changeset can't be a merge (yet)\n" % divergent)
+        ui.write_err(msg)
+        hint = _("You have to fallback to solving this by hand...\n"
+                 "| This probably means redoing the merge and using \n"
+                 "| `hg prune` to kill older version.\n")
+        ui.write_err(hint)
+        return 2
     if other.p1() not in divergent.parents():
-        raise util.Abort("parents are not common (not handled yet)",
-                    hint="| %(d)s, %(o)s are not based on the same changeset.\n"
-                         "| With the current state of its implementation, \n"
-                         "| evolve does not work in that case.\n"
-                         "| rebase one of them next to the other and run \n"
-                         "| this command again.\n"
-                         "| - either: hg rebase --dest 'p1(%(d)s)' -r %(o)s\n"
-                         "| - or:     hg rebase --dest 'p1(%(o)s)' -r %(d)s"
-                              % {'d': divergent, 'o': other})
+        msg = _("skipping %s: have a different parent than %s (not handled yet)\n") % (divergent, other)
+        hint = _("| %(d)s, %(o)s are not based on the same changeset.\n"
+                 "| With the current state of its implementation, \n"
+                 "| evolve does not work in that case.\n"
+                 "| rebase one of them next to the other and run \n"
+                 "| this command again.\n"
+                 "| - either: hg rebase --dest 'p1(%(d)s)' -r %(o)s\n"
+                 "| - or:     hg rebase --dest 'p1(%(o)s)' -r %(d)s\n"
+                 % {'d': divergent, 'o': other})
+        ui.write_err(msg)
+        ui.write_err(hint)
+        return 2
 
     displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
     if not ui.quiet or confirm:
--- a/tests/test-evolve-order.t	Fri Jun 19 17:03:40 2015 -0700
+++ b/tests/test-evolve-order.t	Fri Jun 19 17:35:29 2015 -0700
@@ -258,5 +258,6 @@
   $ hg evolve --rev 'unstable()'
   move:[30] add b4_
   atop:[35] b3second
+  skipping 08a530ce67e1: divergent rewriting. can't choose destination
   working directory is now at a51a8a82fdba