Patchwork rebase: remove experimental option from 'rebase' config section

login
register
mail settings
Submitter Pierre-Yves David
Date Feb. 27, 2016, 6:02 p.m.
Message ID <5000a7efef468a32e4e0.1456596123@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/13437/
State Accepted
Commit dc6032a1d888816365bacba24c6ae3f51543630e
Headers show

Comments

Pierre-Yves David - Feb. 27, 2016, 6:02 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1456592532 -3600
#      Sat Feb 27 18:02:12 2016 +0100
# Node ID 5000a7efef468a32e4e0b2d26a5ed2dfe75229f4
# Parent  41dcd754526612c43b9695df8851557c851828ef
# Available At http://hg.netv6.net/marmoute-wip/mercurial/
#              hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r 5000a7efef46
rebase: remove experimental option from 'rebase' config section

Changeset f0e9f38d250f introduced a guard against case where obsolete changesets
are included in the rebase in a way this will result in divergence (because
rebase create new successors for changeset which already have successors). In
the same go a 'rebase.allowdivergence' option was introduced to control that
behavior.

We rename this config option to 'experimental.allowdivergence' for multiple
reasons:

* First this behavior is attached to changeset evolution, a feature still
 experimental.

* Second, there was no 'rebase' section in config before we introduced this
  option. I would like to avoid proliferation of micro config section and
  therefore would like to avoid the creation of this new section just for an
  experimental feature.

* Third, this guard (warning the user about a history rewriting operation that
  will create divergence) will very likely be generalised to all history
  rewriting operations, making this not rebase specific.

* Finally, because this will likely be a general guard present a bit everywhere
  in the UI we'll likely end up with something better than a config option to
  control this behavior, so having the current config option living in
  experimental will allow us make it disappear in the future.

So we banish this config option back to the experimental section where it
belongs, killing the newly born 'rebase' config section in the process.
Martin von Zweigbergk - Feb. 27, 2016, 7:23 p.m.
See
http://thread.gmane.org/gmane.comp.version-control.mercurial.devel/87877/focus=87881

On Sat, Feb 27, 2016, 10:02 Pierre-Yves David <
pierre-yves.david@ens-lyon.org> wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1456592532 -3600
> #      Sat Feb 27 18:02:12 2016 +0100
> # Node ID 5000a7efef468a32e4e0b2d26a5ed2dfe75229f4
> # Parent  41dcd754526612c43b9695df8851557c851828ef
> # Available At http://hg.netv6.net/marmoute-wip/mercurial/
> #              hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r
> 5000a7efef46
> rebase: remove experimental option from 'rebase' config section
>
> Changeset f0e9f38d250f introduced a guard against case where obsolete
> changesets
> are included in the rebase in a way this will result in divergence (because
> rebase create new successors for changeset which already have successors).
> In
> the same go a 'rebase.allowdivergence' option was introduced to control
> that
> behavior.
>
> We rename this config option to 'experimental.allowdivergence' for multiple
> reasons:
>
> * First this behavior is attached to changeset evolution, a feature still
>  experimental.
>
> * Second, there was no 'rebase' section in config before we introduced this
>   option. I would like to avoid proliferation of micro config section and
>   therefore would like to avoid the creation of this new section just for
> an
>   experimental feature.
>
> * Third, this guard (warning the user about a history rewriting operation
> that
>   will create divergence) will very likely be generalised to all history
>   rewriting operations, making this not rebase specific.
>
> * Finally, because this will likely be a general guard present a bit
> everywhere
>   in the UI we'll likely end up with something better than a config option
> to
>   control this behavior, so having the current config option living in
>   experimental will allow us make it disappear in the future.
>
> So we banish this config option back to the experimental section where it
> belongs, killing the newly born 'rebase' config section in the process.
>
> diff --git a/hgext/rebase.py b/hgext/rebase.py
> --- a/hgext/rebase.py
> +++ b/hgext/rebase.py
> @@ -304,21 +304,21 @@ def rebase(ui, repo, **opts):
>
>  rebaseobsrevs,
>                                                                  dest)
>                  rebaseobsskipped = set(obsoletenotrebased)
>
>                  # Obsolete node with successors not in dest leads to
> divergence
> -                divergenceok = ui.configbool('rebase',
> +                divergenceok = ui.configbool('experimental',
>                                               'allowdivergence')
>                  divergencebasecandidates = rebaseobsrevs -
> rebaseobsskipped
>
>                  if divergencebasecandidates and not divergenceok:
>                      divhashes = (str(repo[r])
>                                   for r in divergencebasecandidates)
>                      msg = _("this rebase will cause "
>                              "divergences from: %s")
>                      h = _("to force the rebase please set "
> -                          "rebase.allowdivergence=True")
> +                          "experimental.allowdivergence=True")
>                      raise error.Abort(msg % (",".join(divhashes),),
> hint=h)
>
>                  # - plain prune (no successor) changesets are rebased
>                  # - split changesets are not rebased if at least one of
> the
>                  # changeset resulting from the split is an ancestor of
> dest
> diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
> --- a/tests/test-rebase-obsolete.t
> +++ b/tests/test-rebase-obsolete.t
> @@ -770,11 +770,11 @@ If a rebase is going to create divergenc
>    update: 2 new changesets, 3 branch heads (merge)
>    phases: 8 draft
>    unstable: 1 changesets
>    $ hg rebase -s 10 -d 12
>    abort: this rebase will cause divergences from: 121d9e3bc4c6
> -  (to force the rebase please set rebase.allowdivergence=True)
> +  (to force the rebase please set experimental.allowdivergence=True)
>    [255]
>    $ hg log -G
>    @  15:73568ab6879d bar foo
>    |
>    | o  14:77d874d096a2 10'
> @@ -789,13 +789,13 @@ If a rebase is going to create divergenc
>    |
>    o  2:261e70097290 B2
>    |
>    o  0:4a2df7238c3b A
>
> -With rebase.allowdivergence=True, rebase can create divergence
> +With experimental.allowdivergence=True, rebase can create divergence
>
> -  $ hg rebase -s 10 -d 12 --config rebase.allowdivergence=True
> +  $ hg rebase -s 10 -d 12 --config experimental.allowdivergence=True
>    rebasing 10:121d9e3bc4c6 "P"
>    rebasing 15:73568ab6879d "bar foo" (tip)
>    $ hg summary
>    parent: 17:61bd55f69bc4 tip
>     bar foo
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
Martin von Zweigbergk - Feb. 29, 2016, 6:24 a.m.
On Sun, Feb 28, 2016 at 1:02 AM, Pierre-Yves David
<pierre-yves.david@ens-lyon.org> wrote:
>
>
> On 02/27/2016 08:23 PM, Martin von Zweigbergk wrote:
>>
>> See
>>
>> http://thread.gmane.org/gmane.comp.version-control.mercurial.devel/87877/focus=87881
>
>
> See my changeset description.

Yes, sorry about the short message. I didn't have time to read through
and think about it but still wanted to make sure you had not missed
the previous discussion.

My point there was that it seems wrong to ask users to turn on an
experimental option to keep the current behavior, but as you said,
changeset evolution itself is experimental, so affected users have
already opted in to experimental functionality. Makes sense and sorry
about the extra work. Pushed to the clowncopter.

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -304,21 +304,21 @@  def rebase(ui, repo, **opts):
                                                                 rebaseobsrevs,
                                                                 dest)
                 rebaseobsskipped = set(obsoletenotrebased)
 
                 # Obsolete node with successors not in dest leads to divergence
-                divergenceok = ui.configbool('rebase',
+                divergenceok = ui.configbool('experimental',
                                              'allowdivergence')
                 divergencebasecandidates = rebaseobsrevs - rebaseobsskipped
 
                 if divergencebasecandidates and not divergenceok:
                     divhashes = (str(repo[r])
                                  for r in divergencebasecandidates)
                     msg = _("this rebase will cause "
                             "divergences from: %s")
                     h = _("to force the rebase please set "
-                          "rebase.allowdivergence=True")
+                          "experimental.allowdivergence=True")
                     raise error.Abort(msg % (",".join(divhashes),), hint=h)
 
                 # - plain prune (no successor) changesets are rebased
                 # - split changesets are not rebased if at least one of the
                 # changeset resulting from the split is an ancestor of dest
diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
--- a/tests/test-rebase-obsolete.t
+++ b/tests/test-rebase-obsolete.t
@@ -770,11 +770,11 @@  If a rebase is going to create divergenc
   update: 2 new changesets, 3 branch heads (merge)
   phases: 8 draft
   unstable: 1 changesets
   $ hg rebase -s 10 -d 12
   abort: this rebase will cause divergences from: 121d9e3bc4c6
-  (to force the rebase please set rebase.allowdivergence=True)
+  (to force the rebase please set experimental.allowdivergence=True)
   [255]
   $ hg log -G
   @  15:73568ab6879d bar foo
   |
   | o  14:77d874d096a2 10'
@@ -789,13 +789,13 @@  If a rebase is going to create divergenc
   |
   o  2:261e70097290 B2
   |
   o  0:4a2df7238c3b A
   
-With rebase.allowdivergence=True, rebase can create divergence
+With experimental.allowdivergence=True, rebase can create divergence
 
-  $ hg rebase -s 10 -d 12 --config rebase.allowdivergence=True
+  $ hg rebase -s 10 -d 12 --config experimental.allowdivergence=True
   rebasing 10:121d9e3bc4c6 "P"
   rebasing 15:73568ab6879d "bar foo" (tip)
   $ hg summary
   parent: 17:61bd55f69bc4 tip
    bar foo