Patchwork [v3] rebase: turn rebaseskipobsolete on by default

login
register
mail settings
Submitter Kostia Balytskyi
Date March 9, 2016, 4:12 p.m.
Message ID <d25f8b503ecbcb4e5186.1457539971@dev1902.lla1.facebook.com>
Download mbox | patch
Permalink /patch/13725/
State Accepted
Headers show

Comments

Kostia Balytskyi - March 9, 2016, 4:12 p.m.
# HG changeset patch
# User Kostia Balytskyi <ikostia@fb.com>
# Date 1457539707 28800
#      Wed Mar 09 08:08:27 2016 -0800
# Node ID d25f8b503ecbcb4e518608729aa72346fba9aa09
# Parent  f126bb86a4e282fc1113a9c67777e9ca3764e57b
rebase: turn rebaseskipobsolete on by default

Consider the following use case. User has a set of commits he wants to rebase
onto some destination. Some of the commits in the set are already rebased
and their new versions are now among the ancestors of destination. Traditional
rebase behavior would make the rebase and effectively try to apply older
versions of these commits on top of newer versions, like this:
``a' --> b --> a''`` where both ``a'`` and ``a''`` are
rebased versions of ``a``.
This is not desired since ``b`` might have made changes to ``a'`` which can
now result in merge conflicts. We can avoid these merge conflicts since we
know that ``a''`` is an older version of ``a'``, so we don't even need to put
it on top of ``b``. Rebaseskipobsolete allows us to do exactly that.

Another undesired effect of a pure rebase is that now ``a'`` and ``a''`` are
both successors to ``a`` which is a divergence. We don't want that and not
rebasing ``a`` the second time allows to avoid it.
Pierre-Yves David - March 9, 2016, 11:59 p.m.
On 03/09/2016 04:12 PM, Kostia Balytskyi wrote:
> # HG changeset patch
> # User Kostia Balytskyi <ikostia@fb.com>
> # Date 1457539707 28800
> #      Wed Mar 09 08:08:27 2016 -0800
> # Node ID d25f8b503ecbcb4e518608729aa72346fba9aa09
> # Parent  f126bb86a4e282fc1113a9c67777e9ca3764e57b
> rebase: turn rebaseskipobsolete on by default

Augie asked me on IRC why this was not "on" already. I've updated the 
commit message with the following:

This was not enabled by default initially because we wanted to have some 
more experience with it. After months of painless usages in multiple 
places, we are confident enough to turn it on my default.

I've changed the quoting scheme to be in line with the project usage (we 
use ' instead of ``) and pushed the result to the clowncopter. Thanks.

Cheers,

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -297,7 +297,8 @@  def rebase(ui, repo, **opts):
                     hint=_('use --keep to keep original changesets'))
 
             obsoletenotrebased = {}
-            if ui.configbool('experimental', 'rebaseskipobsolete'):
+            if ui.configbool('experimental', 'rebaseskipobsolete',
+                             default=True):
                 rebasesetrevs = set(rebaseset)
                 rebaseobsrevs = _filterobsoleterevs(repo, rebasesetrevs)
                 obsoletenotrebased = _computeobsoletenotrebased(repo,
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
@@ -527,7 +527,7 @@  Test hidden changesets in the rebase set
   $ hg commit -m J
   $ hg debugobsolete `hg log --rev . -T '{node}'`
 
-  $ hg rebase --rev .~1::. --dest 'max(desc(D))' --traceback
+  $ hg rebase --rev .~1::. --dest 'max(desc(D))' --traceback --config experimental.rebaseskipobsolete=off
   rebasing 9:4bde274eefcf "I"
   rebasing 13:06edfc82198f "J" (tip)
   $ hg log -G