Submitter | Durham Goode |
---|---|
Date | Oct. 14, 2014, 9:51 p.m. |
Message ID | <03f3746186c5b5e12dbf.1413323511@dev2000.prn2.facebook.com> |
Download | mbox | patch |
Permalink | /patch/6260/ |
State | Superseded |
Headers | show |
Comments
On Tue, Oct 14, 2014 at 02:51:51PM -0700, Durham Goode wrote: > # HG changeset patch > # User Durham Goode <durham@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@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel
On 10/15/14, 11:50 AM, "Augie Fackler" <raf@durin42.com> wrote: >On Tue, Oct 14, 2014 at 02:51:51PM -0700, Durham Goode wrote: >> # HG changeset patch >> # User Durham Goode <durham@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'. Not really. Histedit could only force allowunstable on if createmarkers was already on (a future patch enforces that), which means we couldn¹t allow unstable unless the user has already opted in at least somewhat. So it doesn¹t buy us much.
On 10/15/2014 11:50 AM, Augie Fackler wrote: > On Tue, Oct 14, 2014 at 02:51:51PM -0700, Durham Goode wrote: >> # HG changeset patch >> # User Durham Goode <durham@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'. Yes (or: something along this line, because if create markers is false, amend will happily strip everything above the old version)
On 10/15/14, 12:21 PM, "Durham Goode" <durham@fb.com> wrote: > > >On 10/15/14, 11:50 AM, "Augie Fackler" <raf@durin42.com> wrote: > >>On Tue, Oct 14, 2014 at 02:51:51PM -0700, Durham Goode wrote: >>> # HG changeset patch >>> # User Durham Goode <durham@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'. > >Not really. Histedit could only force allowunstable on if createmarkers >was already on (a future patch enforces that), which means we couldn¹t >allow unstable unless the user has already opted in at least somewhat. So >it doesn¹t buy us much. Actually, I may have misunderstood your question. I guess the answer is maybe. But a future patch does prevent these options from being on without createmarkers being on already, so we may want to rethink that if having individual options enabled is desirable.
Patch
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