# HG changeset patch # User Pierre-Yves David # Date 1345545801 -7200 # Node ID f17a0f801e0bcf8b4a5fe2f6744598251c26f437 # Parent 9f69a5e41ab0119165ee67d49f5cea26d0b71532 [evolve] amend: display proper error message while trying to amend non ancestor diff -r 9f69a5e41ab0 -r f17a0f801e0b hgext/evolve.py --- a/hgext/evolve.py Tue Aug 21 12:42:09 2012 +0200 +++ b/hgext/evolve.py Tue Aug 21 12:43:21 2012 +0200 @@ -416,6 +416,8 @@ if old.phase() == phases.public: raise util.Abort(_("can not rewrite immutable changeset %s") % old) + if not repo.revs('%d and (::.)', old): + raise error.Abort(_('cannot amend non ancestor changeset')) tr = repo.transaction('amend') try: oldphase = old.phase() diff -r 9f69a5e41ab0 -r f17a0f801e0b tests/test-evolve.t --- a/tests/test-evolve.t Tue Aug 21 12:42:09 2012 +0200 +++ b/tests/test-evolve.t Tue Aug 21 12:43:21 2012 +0200 @@ -238,6 +238,12 @@ [255] +(amend of on ancestors) + + $ hg amend -c 2 + abort: cannot amend non ancestor changeset + [255] + $ hg amend --note 'french looks better' 1 new unstables changesets $ hg log