# HG changeset patch # User Augie Fackler # Date 1374701969 14400 # Node ID 10a0ae668fe62418b89fc58da26b0f40172266b2 # Parent 32e502b26983eaa89574835a024a9b035ad72bf4 histedit: refuse to edit history that contains merges (issue3962) diff -r 32e502b26983 -r 10a0ae668fe6 hgext/histedit.py --- a/hgext/histedit.py Wed Jul 24 13:20:44 2013 +0800 +++ b/hgext/histedit.py Wed Jul 24 17:39:29 2013 -0400 @@ -679,6 +679,8 @@ if (not obsolete._enabled and repo.revs('(%ld::) - (%ld)', ctxs, ctxs)): raise util.Abort(_('cannot edit history that would orphan nodes')) + if repo.revs('(%ld) and merge()', ctxs): + raise util.Abort(_('cannot edit history that contains merges')) root = ctxs[0] # list is already sorted by repo.set if not root.phase(): raise util.Abort(_('cannot edit immutable changeset: %s') % root) diff -r 32e502b26983 -r 10a0ae668fe6 tests/test-histedit-obsolete.t --- a/tests/test-histedit-obsolete.t Wed Jul 24 13:20:44 2013 +0800 +++ b/tests/test-histedit-obsolete.t Wed Jul 24 17:39:29 2013 -0400 @@ -441,4 +441,19 @@ | o 0:cb9a9f314b8b (public) a + $ hg co 18 + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ echo wat >> wat + $ hg add wat + $ hg ci -m 'add wat' + created new head + $ hg merge 19 + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + $ hg ci -m 'merge' + $ echo not wat > wat + $ hg ci -m 'modify wat' + $ hg histedit 17 + abort: cannot edit history that contains merges + [255] $ cd ..