diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -738,7 +738,7 @@ 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 (not obsolete._enabled and + if (not obsolete.isenabled(repo, obsolete.allowunstableopt) and repo.revs('(%ld::) - (%ld)', ctxs, ctxs)): raise util.Abort(_('cannot edit history that would orphan nodes')) if repo.revs('(%ld) and merge()', ctxs): diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -303,7 +303,8 @@ def rebase(ui, repo, **opts): ('+'.join(str(repo[r]) for r in base), dest)) return 1 - if (not (keepf or obsolete._enabled) + allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) + if (not (keepf or allowunstable) and repo.revs('first(children(%ld) - %ld)', rebaseset, rebaseset)): raise util.Abort( diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1450,7 +1450,8 @@ def commit(ui, repo, *pats, **opts): raise util.Abort(_('cannot amend public changesets')) if len(repo[None].parents()) > 1: raise util.Abort(_('cannot amend while merging')) - if (not obsolete._enabled) and old.children(): + allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) + if not allowunstable and old.children(): raise util.Abort(_('cannot amend changeset with children')) # commitfunc is used only for temporary amend commit by cmdutil.amend diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -83,6 +83,7 @@ from i18n import _ # Options for obsolescence createmarkersopt = 'createmarkers' +allowunstableopt = 'allowunstable' ### obsolescence marker flag