Comments
Patch
@@ -591,11 +591,12 @@ def between(repo, old, new, keep):
"""select and validate the set of revision to edit
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):
+ orphans = repo.revs('(%ld::) - (%ld + hidden())', ctxs, ctxs)
+ if orphans and obsolete.preventunstable(repo.ui):
raise util.Abort(_('cannot edit history that would orphan nodes'))
root = ctxs[0] # list is already sorted by repo.set
if not root.phase():
raise util.Abort(_('cannot edit immutable changeset: %s') % root)
return [c.node() for c in ctxs]
@@ -139,5 +139,22 @@ Check that histedit respect phases
$ hg ph -pv '.^'
phase changed for 2 changesets
$ 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 histedit -r '.'
+ abort: cannot edit history that would orphan nodes
+ [255]
+ $ cat >> $HGRCPATH << EOF
+ > [ui]
+ > prevent-unstable=False
+ > EOF
+ $ hg histedit -r '.'
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved