D1063: rebase: enable multidest by default

quark (Jun Wu) phabricator at mercurial-scm.org
Fri Oct 13 21:08:36 UTC 2017


quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This was intended to be done by https://phab.mercurial-scm.org/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())::)'

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1063

AFFECTED FILES
  hgext/rebase.py
  mercurial/configitems.py
  tests/test-rebase-dest.t

CHANGE DETAILS

diff --git a/tests/test-rebase-dest.t b/tests/test-rebase-dest.t
--- a/tests/test-rebase-dest.t
+++ b/tests/test-rebase-dest.t
@@ -115,7 +115,6 @@
   > [extensions]
   > maprevset=$TESTTMP/maprevset.py
   > [experimental]
-  > rebase.multidest=true
   > stabilization=all
   > EOF
 
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -341,9 +341,6 @@
 coreconfigitem('experimental', 'obsmarkers-exchange-debug',
     default=False,
 )
-coreconfigitem('experimental', 'rebase.multidest',
-    default=False,
-)
 coreconfigitem('experimental', 'revertalternateinteractivemode',
     default=True,
 )
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -638,6 +638,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).
 
@@ -686,6 +691,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
@@ -878,8 +889,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:



To: quark, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list