# HG changeset patch # User Anton Shestakov # Date 1562663314 -28800 # Node ID 0e0731406efdd4d53eb1421d52bf4f635e8f44b2 # Parent cc3569da7150a8124c661983e6d4b6e1f44c443e rewriteutil: allow rewriting merge commits (issue4561) This patch simply allows rewriteutil.rewrite() to work with commits with multiple parents (i.e. merges). That function is used in such commands as fold, metaedit, touch, rewind. The issue 4561 is marked as easy, the limitation is called unnecessary, no tests fail after this change. What can go wrong. diff -r cc3569da7150 -r 0e0731406efd CHANGELOG --- a/CHANGELOG Tue Jul 09 17:02:44 2019 +0800 +++ b/CHANGELOG Tue Jul 09 17:08:34 2019 +0800 @@ -8,6 +8,7 @@ * evolve: minor output message improvements * evolve: improve `hg evolve --all` behavior when "." is obsolete * topic: fix confusion in branch heads checking logic + * touch: now works on merge commit too 9.0.1 - in progress ------------------- diff -r cc3569da7150 -r 0e0731406efd hgext3rd/evolve/rewriteutil.py --- a/hgext3rd/evolve/rewriteutil.py Tue Jul 09 17:02:44 2019 +0800 +++ b/hgext3rd/evolve/rewriteutil.py Tue Jul 09 17:08:34 2019 +0800 @@ -171,8 +171,6 @@ wlock = repo.wlock() lock = repo.lock() tr = repo.transaction('rewrite') - if len(old.parents()) > 1: # XXX remove this unnecessary limitation. - raise error.Abort(_('cannot amend merge changesets')) base = old.p1() updatebookmarks = bookmarksupdater(repo, old.node(), tr) diff -r cc3569da7150 -r 0e0731406efd tests/test-touch.t --- a/tests/test-touch.t Tue Jul 09 17:02:44 2019 +0800 +++ b/tests/test-touch.t Tue Jul 09 17:08:34 2019 +0800 @@ -186,5 +186,11 @@ working directory is now at * (glob) 1 changesets pruned $ hg touch 16 --hidden - abort: cannot amend merge changesets - [255] + $ hg glog -r '12+15+17' + o 17: merge + |\ + | o 15: ab + | + @ 12: move + | + ~