[PATCH 4 of 5] obsolete: add allowunstable option
Augie Fackler
raf at durin42.com
Wed Oct 15 13:50:25 CDT 2014
On Tue, Oct 14, 2014 at 02:51:51PM -0700, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham at fb.com>
> # Date 1413318313 25200
> # Tue Oct 14 13:25:13 2014 -0700
> # Node ID 03f3746186c5b5e12dbf81278557297ab4071393
> # Parent 70613113a0765b0e7133db0e0bad42a7254b3531
> obsolete: add allowunstable option
Iiinteresting. Does the end-state of this series look something like
histedit being able to force-on "allowunstable" during the histedit
process? That'd be *awesome* for things like 'stop'.
>
> This option allows the creation of unstable commits. This allows things like
> amending the in the middle of a stack of commits, etc.
>
> 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
> @@ -82,6 +82,7 @@ from i18n import _
> _enabled = False
> # Enablable options for obsolesence
> createmarkersopt = 'createmarkers'
> +allowunstableopt = 'allowunstable'
>
> ### obsolescence marker flag
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list