diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -593,7 +593,8 @@ def between(repo, old, new, keep): When keep is false, the specified set can't have children.""" ctxs = list(repo.set('%n::%n', old, new)) if ctxs and not keep: - if repo.revs('(%ld::) - (%ld + hidden())', ctxs, ctxs): + if (not obsolete._enabled and + repo.revs('(%ld::) - (%ld + hidden())', ctxs, ctxs)): raise util.Abort(_('cannot edit history that would orphan nodes')) root = ctxs[0] # list is already sorted by repo.set if not root.phase(): diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t --- a/tests/test-histedit-obsolete.t +++ b/tests/test-histedit-obsolete.t @@ -141,3 +141,15 @@ Check that histedit respect phases $ hg histedit -r '.~2' abort: cannot edit immutable changeset: cb9a9f314b8b [255] + + ++Test ui.prevent-unstable option ++------------------------------------ + + $ hg up '.^' + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg phase --force --draft . + $ hg log -r 'children(.)' + 9:7c044e3e33a9 f (no-eol) + $ hg histedit -r '.' + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved