# HG changeset patch # User Pierre-Yves David # Date 2012-12-31 23:46:22 # Node ID 0f5a0a2073a84f869e9b93706c312361d3729dfd # Parent bacf55bd8f9051b6d0be8bd5d3d086557d2ef8cc histedit: allow operation from non-head if obsolete is enabled Obsolescence markers can represent this situation just fine. Rewritten revisions are marked as precursors of the ones creates by histedit. Unaffected descendants become "unstable". If obsolescence is not enabled we keep the current behavior of aborting. This new behavior only applies when obsolete is enabled and is subject to future discussion and changes. 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