rebase: enable multidest by default
authorJun Wu <quark@fb.com>
Fri, 13 Oct 2017 14:08:14 -0700
changeset 35287 3398603c5621
parent 35286 307b1689e3f8
child 35288 5db3c748ce8f
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
hgext/rebase.py
mercurial/configitems.py
tests/test-rebase-dest.t
--- 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:
--- 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,
 )
--- 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