comparison hgext/rebase.py @ 35287:3398603c5621

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
author Jun Wu <quark@fb.com>
date Fri, 13 Oct 2017 14:08:14 -0700
parents f56a30b844aa
children 482614b3802a
comparison
equal deleted inserted replaced
35286:307b1689e3f8 35287:3398603c5621
641 and their descendants which are not also ancestors of the destination. 641 and their descendants which are not also ancestors of the destination.
642 642
643 4. If you do not specify any of ``--rev``, ``source``, or ``--base``, 643 4. If you do not specify any of ``--rev``, ``source``, or ``--base``,
644 rebase will use ``--base .`` as above. 644 rebase will use ``--base .`` as above.
645 645
646 If ``--source`` or ``--rev`` is used, special names ``SRC`` and ``ALLSRC``
647 can be used in ``--dest``. Destination would be calculated per source
648 revision with ``SRC`` substituted by that single source revision and
649 ``ALLSRC`` substituted by all source revisions.
650
646 Rebase will destroy original changesets unless you use ``--keep``. 651 Rebase will destroy original changesets unless you use ``--keep``.
647 It will also move your bookmarks (even if you do). 652 It will also move your bookmarks (even if you do).
648 653
649 Some changesets may be dropped if they do not contribute changes 654 Some changesets may be dropped if they do not contribute changes
650 (e.g. merges from the destination branch). 655 (e.g. merges from the destination branch).
688 hg rebase --collapse -r 1520:1525 -d . 693 hg rebase --collapse -r 1520:1525 -d .
689 694
690 - move a named branch while preserving its name:: 695 - move a named branch while preserving its name::
691 696
692 hg rebase -r "branch(featureX)" -d 1.3 --keepbranches 697 hg rebase -r "branch(featureX)" -d 1.3 --keepbranches
698
699 - stabilize orphaned changesets so history looks linear::
700
701 hg rebase -r 'orphan()-obsolete()'\
702 -d 'first(max((successors(max(roots(ALLSRC) & ::SRC)^)-obsolete())::) +\
703 max(::((roots(ALLSRC) & ::SRC)^)-obsolete()))'
693 704
694 Configuration Options: 705 Configuration Options:
695 706
696 You can make rebase require a destination if you set the following config 707 You can make rebase require a destination if you set the following config
697 option:: 708 option::
882 if dest is None: 893 if dest is None:
883 try: 894 try:
884 # fast path: try to resolve dest without SRC alias 895 # fast path: try to resolve dest without SRC alias
885 dest = scmutil.revsingle(repo, destf, localalias=alias) 896 dest = scmutil.revsingle(repo, destf, localalias=alias)
886 except error.RepoLookupError: 897 except error.RepoLookupError:
887 if not ui.configbool('experimental', 'rebase.multidest'):
888 raise
889 # multi-dest path: resolve dest for each SRC separately 898 # multi-dest path: resolve dest for each SRC separately
890 destmap = {} 899 destmap = {}
891 for r in rebaseset: 900 for r in rebaseset:
892 alias['SRC'] = revsetlang.formatspec('%d', r) 901 alias['SRC'] = revsetlang.formatspec('%d', r)
893 # use repo.anyrevs instead of scmutil.revsingle because we 902 # use repo.anyrevs instead of scmutil.revsingle because we