# HG changeset patch # User Jun Wu # Date 1507928894 25200 # Node ID 3398603c5621b52dcd6b4c31444635a6979d561d # Parent 307b1689e3f88cba4882d7d2b359d19b44c17f0d rebase: enable multidest by default This was intended to be done by D470. But there was a minor documentation issue. The feature is quite usable now so it gets formally documented and enabled. There is no behavior change for people not using the `SRC` or `ALLSRC` in rebase destination revset. .. feature:: Rebase with different destination per source revision Previously, rebase only supports one unique destination. Now ``SRC`` and ``ALLSRC`` can be used in rebase destination revset to precisely define destination per each individual source revision. For example, the following command could move some orphaned changesets to reasonable new places so they become no longer orphaned:: hg rebase -r 'orphan()-obsolete()' -d 'max((successors(max(roots(ALLSRC) & ::SRC)^)-obsolete())::)' Differential Revision: https://phab.mercurial-scm.org/D1063 diff -r 307b1689e3f8 -r 3398603c5621 hgext/rebase.py --- a/hgext/rebase.py Fri Dec 01 00:07:23 2017 -0800 +++ b/hgext/rebase.py Fri Oct 13 14:08:14 2017 -0700 @@ -643,6 +643,11 @@ 4. If you do not specify any of ``--rev``, ``source``, or ``--base``, rebase will use ``--base .`` as above. + If ``--source`` or ``--rev`` is used, special names ``SRC`` and ``ALLSRC`` + can be used in ``--dest``. Destination would be calculated per source + revision with ``SRC`` substituted by that single source revision and + ``ALLSRC`` substituted by all source revisions. + Rebase will destroy original changesets unless you use ``--keep``. It will also move your bookmarks (even if you do). @@ -691,6 +696,12 @@ hg rebase -r "branch(featureX)" -d 1.3 --keepbranches + - stabilize orphaned changesets so history looks linear:: + + hg rebase -r 'orphan()-obsolete()'\ + -d 'first(max((successors(max(roots(ALLSRC) & ::SRC)^)-obsolete())::) +\ + max(::((roots(ALLSRC) & ::SRC)^)-obsolete()))' + Configuration Options: You can make rebase require a destination if you set the following config @@ -884,8 +895,6 @@ # fast path: try to resolve dest without SRC alias dest = scmutil.revsingle(repo, destf, localalias=alias) except error.RepoLookupError: - if not ui.configbool('experimental', 'rebase.multidest'): - raise # multi-dest path: resolve dest for each SRC separately destmap = {} for r in rebaseset: diff -r 307b1689e3f8 -r 3398603c5621 mercurial/configitems.py --- a/mercurial/configitems.py Fri Dec 01 00:07:23 2017 -0800 +++ b/mercurial/configitems.py Fri Oct 13 14:08:14 2017 -0700 @@ -532,9 +532,6 @@ coreconfigitem('experimental', 'obsmarkers-exchange-debug', default=False, ) -coreconfigitem('experimental', 'rebase.multidest', - default=False, -) coreconfigitem('experimental', 'remotenames', default=False, ) diff -r 307b1689e3f8 -r 3398603c5621 tests/test-rebase-dest.t --- a/tests/test-rebase-dest.t Fri Dec 01 00:07:23 2017 -0800 +++ b/tests/test-rebase-dest.t Fri Oct 13 14:08:14 2017 -0700 @@ -115,7 +115,6 @@ > [extensions] > maprevset=$TESTTMP/maprevset.py > [experimental] - > rebase.multidest=true > evolution=true > EOF