changeset 22952:8792ac090e3b

obsolete: add allowunstable option This option allows the creation of unstable commits. This allows things like amending in the middle of a stack of commits, etc.
author Durham Goode <durham@fb.com>
date Tue, 14 Oct 2014 13:25:13 -0700
parents 6c86c673dde6
children b1d694d3975e
files hgext/histedit.py hgext/rebase.py mercurial/commands.py mercurial/obsolete.py
diffstat 4 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Tue Oct 14 13:23:52 2014 -0700
+++ b/hgext/histedit.py	Tue Oct 14 13:25:13 2014 -0700
@@ -738,7 +738,7 @@
     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):
--- a/hgext/rebase.py	Tue Oct 14 13:23:52 2014 -0700
+++ b/hgext/rebase.py	Tue Oct 14 13:25:13 2014 -0700
@@ -303,7 +303,8 @@
                                   ('+'.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(
--- a/mercurial/commands.py	Tue Oct 14 13:23:52 2014 -0700
+++ b/mercurial/commands.py	Tue Oct 14 13:25:13 2014 -0700
@@ -1450,7 +1450,8 @@
             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
--- a/mercurial/obsolete.py	Tue Oct 14 13:23:52 2014 -0700
+++ b/mercurial/obsolete.py	Tue Oct 14 13:25:13 2014 -0700
@@ -83,6 +83,7 @@
 
 # Options for obsolescence
 createmarkersopt = 'createmarkers'
+allowunstableopt = 'allowunstable'
 
 ### obsolescence marker flag