comparison hgext/evolve.py @ 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
comparison
equal deleted inserted replaced
1411:64515965c0df 1412:8794a4680bdd
1407 rev = solvablerevs.popleft() 1407 rev = solvablerevs.popleft()
1408 for dependent in rdependencies[rev]: 1408 for dependent in rdependencies[rev]:
1409 dependencies[dependent].remove(rev) 1409 dependencies[dependent].remove(rev)
1410 if not dependencies[dependent]: 1410 if not dependencies[dependent]:
1411 solvablerevs.append(dependent) 1411 solvablerevs.append(dependent)
1412 del dependencies[rev]
1412 ordering.append(rev) 1413 ordering.append(rev)
1413 1414
1415 ordering.extend(sorted(dependencies))
1414 return ordering 1416 return ordering
1415 1417
1416 @command('^evolve|stabilize|solve', 1418 @command('^evolve|stabilize|solve',
1417 [('n', 'dry-run', False, 1419 [('n', 'dry-run', False,
1418 'do not perform actions, just print what would be done'), 1420 'do not perform actions, just print what would be done'),
1607 " trying to stabilize on its parent\n" % 1609 " trying to stabilize on its parent\n" %
1608 obs) 1610 obs)
1609 obs = obs.parents()[0] 1611 obs = obs.parents()[0]
1610 newer = obsolete.successorssets(repo, obs.node()) 1612 newer = obsolete.successorssets(repo, obs.node())
1611 if len(newer) > 1: 1613 if len(newer) > 1:
1612 raise util.Abort(_("conflict rewriting. can't choose destination\n")) 1614 msg = _("skipping %s: divergent rewriting. can't choose destination\n" % obs)
1615 ui.write_err(msg)
1616 return 2
1613 targets = newer[0] 1617 targets = newer[0]
1614 assert targets 1618 assert targets
1615 if len(targets) > 1: 1619 if len(targets) > 1:
1616 raise util.Abort(_("does not handle split parents yet\n")) 1620 msg = _("does not handle split parents yet\n")
1621 ui.write_err(msg)
1617 return 2 1622 return 2
1618 target = targets[0] 1623 target = targets[0]
1619 displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate}) 1624 displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
1620 target = repo[target] 1625 target = repo[target]
1621 if not ui.quiet or confirm: 1626 if not ui.quiet or confirm:
1648 """Stabilize a bumped changeset""" 1653 """Stabilize a bumped changeset"""
1649 repo = repo.unfiltered() 1654 repo = repo.unfiltered()
1650 bumped = repo[bumped.rev()] 1655 bumped = repo[bumped.rev()]
1651 # For now we deny bumped merge 1656 # For now we deny bumped merge
1652 if len(bumped.parents()) > 1: 1657 if len(bumped.parents()) > 1:
1653 raise util.Abort('late comer stabilization is confused by bumped' 1658 msg = _('skipping %s : we do not handle merge yet\n' % bumped)
1654 ' %s being a merge' % bumped) 1659 ui.write_err(msg)
1660 return 2
1655 prec = repo.set('last(allprecursors(%d) and public())', bumped).next() 1661 prec = repo.set('last(allprecursors(%d) and public())', bumped).next()
1656 # For now we deny target merge 1662 # For now we deny target merge
1657 if len(prec.parents()) > 1: 1663 if len(prec.parents()) > 1:
1658 raise util.Abort('late comer evolution is confused by precursors' 1664 msg = _('skipping: %s: public version is a merge, this not handled yet\n' % prec)
1659 ' %s being a merge' % prec) 1665 ui.write_err(msg)
1666 return 2
1660 1667
1661 displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate}) 1668 displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
1662 if not ui.quiet or confirm: 1669 if not ui.quiet or confirm:
1663 repo.ui.write(_('recreate:')) 1670 repo.ui.write(_('recreate:'))
1664 displayer.show(bumped) 1671 displayer.show(bumped)
1757 repo = repo.unfiltered() 1764 repo = repo.unfiltered()
1758 divergent = repo[divergent.rev()] 1765 divergent = repo[divergent.rev()]
1759 base, others = divergentdata(divergent) 1766 base, others = divergentdata(divergent)
1760 if len(others) > 1: 1767 if len(others) > 1:
1761 othersstr = "[%s]" % (','.join([str(i) for i in others])) 1768 othersstr = "[%s]" % (','.join([str(i) for i in others]))
1762 hint = ("changeset %d is divergent with a changeset that got splitted " 1769 msg = _("skipping %d:divergent with a changeset that got splitted into multiple ones:\n"
1763 "| into multiple ones:\n[%s]\n" 1770 "|[%s]\n"
1764 "| This is not handled by automatic evolution yet\n" 1771 "| This is not handled by automatic evolution yet\n"
1765 "| You have to fallback to manual handling with commands " 1772 "| You have to fallback to manual handling with commands "
1766 "such as:\n" 1773 "such as:\n"
1767 "| - hg touch -D\n" 1774 "| - hg touch -D\n"
1768 "| - hg prune\n" 1775 "| - hg prune\n"
1769 "| \n" 1776 "| \n"
1770 "| You should contact your local evolution Guru for help.\n" 1777 "| You should contact your local evolution Guru for help.\n"
1771 % (divergent, othersstr)) 1778 % (divergent, othersstr))
1772 raise util.Abort("we do not handle divergence with split yet", 1779 ui.write_err(msg)
1773 hint=hint) 1780 return 2
1774 other = others[0] 1781 other = others[0]
1775 if divergent.phase() <= phases.public: 1782 if divergent.phase() <= phases.public:
1776 raise util.Abort("we can't resolve this conflict from the public side", 1783 msg = _("skipping %s: we can't resolve divergence from the public side\n") % divergent
1777 hint="%s is public, try from %s" % (divergent, other)) 1784 ui.write_err(msg)
1785 hint = _("(%s is public, try from %s)\n" % (divergent, other))
1786 ui.write_err(hint)
1787 return 2
1778 if len(other.parents()) > 1: 1788 if len(other.parents()) > 1:
1779 raise util.Abort("divergent changeset can't be a merge (yet)", 1789 msg = _("skipping %s: divergent changeset can't be a merge (yet)\n" % divergent)
1780 hint="You have to fallback to solving this by hand...\n" 1790 ui.write_err(msg)
1781 "| This probably means redoing the merge and using " 1791 hint = _("You have to fallback to solving this by hand...\n"
1782 "| `hg prune` to kill older version.") 1792 "| This probably means redoing the merge and using \n"
1793 "| `hg prune` to kill older version.\n")
1794 ui.write_err(hint)
1795 return 2
1783 if other.p1() not in divergent.parents(): 1796 if other.p1() not in divergent.parents():
1784 raise util.Abort("parents are not common (not handled yet)", 1797 msg = _("skipping %s: have a different parent than %s (not handled yet)\n") % (divergent, other)
1785 hint="| %(d)s, %(o)s are not based on the same changeset.\n" 1798 hint = _("| %(d)s, %(o)s are not based on the same changeset.\n"
1786 "| With the current state of its implementation, \n" 1799 "| With the current state of its implementation, \n"
1787 "| evolve does not work in that case.\n" 1800 "| evolve does not work in that case.\n"
1788 "| rebase one of them next to the other and run \n" 1801 "| rebase one of them next to the other and run \n"
1789 "| this command again.\n" 1802 "| this command again.\n"
1790 "| - either: hg rebase --dest 'p1(%(d)s)' -r %(o)s\n" 1803 "| - either: hg rebase --dest 'p1(%(d)s)' -r %(o)s\n"
1791 "| - or: hg rebase --dest 'p1(%(o)s)' -r %(d)s" 1804 "| - or: hg rebase --dest 'p1(%(o)s)' -r %(d)s\n"
1792 % {'d': divergent, 'o': other}) 1805 % {'d': divergent, 'o': other})
1806 ui.write_err(msg)
1807 ui.write_err(hint)
1808 return 2
1793 1809
1794 displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate}) 1810 displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
1795 if not ui.quiet or confirm: 1811 if not ui.quiet or confirm:
1796 ui.write(_('merge:')) 1812 ui.write(_('merge:'))
1797 displayer.show(divergent) 1813 displayer.show(divergent)