# HG changeset patch # User Pierre-Yves David # Date 1345546070 -7200 # Node ID fded4d945f87f18b8d9412e7056b4404b7cfcaaa # Parent 1f8f8dd75d1890ae16061a3c079e1df317d4600f# Parent f17a0f801e0bcf8b4a5fe2f6744598251c26f437 merge with stable improvement diff -r 1f8f8dd75d18 -r fded4d945f87 hgext/evolve.py --- a/hgext/evolve.py Tue Aug 21 04:36:25 2012 +0200 +++ b/hgext/evolve.py Tue Aug 21 12:47:50 2012 +0200 @@ -569,11 +569,13 @@ try: wlock = repo.wlock() try: + 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: - if old.phase() == phases.public: - raise util.Abort(_("can not rewrite immutable changeset %s") - % old) oldphase = old.phase() # commit current changes as update # code copied from commands.commit to avoid noisy messages diff -r 1f8f8dd75d18 -r fded4d945f87 tests/test-evolve.t --- a/tests/test-evolve.t Tue Aug 21 04:36:25 2012 +0200 +++ b/tests/test-evolve.t Tue Aug 21 12:47:50 2012 +0200 @@ -230,6 +230,21 @@ $ hg bookmark -i feature-A $ sed -i'' -e s/Eins/Un/ main-file-1 +(amend of public changeset denied) + + $ hg phase --public 0 -v + phase changed for 1 changesets + $ hg amend -c 2 + abort: cannot amend non ancestor changeset + [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 @@ -251,7 +266,7 @@ | |/ | x 1:568a468b60fc@default(draft) a nifty feature |/ - @ 0:e55e0562ee93@default(draft) base + @ 0:e55e0562ee93@default(public) base $ hg debugobsolete 524e478d4811d405c8771e4c441de4483bdf8b33 f8111a076f0975cbecb336e2bd3411be22b673fb 0 {'date': '* *', 'user': 'test'} (glob)