# HG changeset patch # User Pierre-Yves David # Date 1356997582 21600 # 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 -r bacf55bd8f90 -r 0f5a0a2073a8 hgext/histedit.py --- a/hgext/histedit.py Mon Dec 31 17:45:52 2012 -0600 +++ b/hgext/histedit.py Mon Dec 31 17:46:22 2012 -0600 @@ -593,7 +593,8 @@ 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 -r bacf55bd8f90 -r 0f5a0a2073a8 tests/test-histedit-obsolete.t --- a/tests/test-histedit-obsolete.t Mon Dec 31 17:45:52 2012 -0600 +++ b/tests/test-histedit-obsolete.t Mon Dec 31 17:46:22 2012 -0600 @@ -141,3 +141,15 @@ $ 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