This is an archive of the discontinued Mercurial Phabricator instance.

rebase: sort destmap topologically
ClosedPublic

Authored by quark on Aug 22 2017, 1:16 AM.

Details

Summary

Previously rebase source and destination could not overlap. But with the
multi-destination support, source and destination could reasonably partially
overlap. That requires another topological sort on {sourcerev: destrev}
graph (destmap). This patch implements that.

If a revision's destination is itself, the error message gets changed from
"source is ancestor of destination" to "source and destination form a
cycle". Not marking as BC since automation should depend on exit code, not
error message.

The multi-destination feature seems quite usable now so its documentation
was formally added.

.. feature:: Rebase with multi-destinations (experimental)

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())::)'

This feature is disabled by default. To enable it, set
``experimental.rebase.multidest`` to ``true``.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

quark created this revision.Aug 22 2017, 1:16 AM
quark edited the summary of this revision. (Show Details)Aug 25 2017, 12:08 AM
quark updated this revision to Diff 1276.

I don't know why, but "make doc" seems to start failing with this patch.

quark updated this revision to Diff 1332.Aug 28 2017, 3:23 AM
quark added inline comments.Aug 28 2017, 3:25 AM
hgext/rebase.py
606

Good catch! It was an unmatched backtick.

The multi-destination feature seems quite usable now so its documentation
was formally added.

It does seem quite usable, but I'm still hesitant to document it. I'd prefer to keep it undocumented (and thus not protected by BC guarantees, I think), so we are more free to change it. What do you think?

quark added a comment.Aug 29 2017, 6:08 PM

The multi-destination feature seems quite usable now so its documentation
was formally added.

It does seem quite usable, but I'm still hesitant to document it. I'd prefer to keep it undocumented (and thus not protected by BC guarantees, I think), so we are more free to change it. What do you think?

Works for me. I can move the docstring to normal comments.

quark added a comment.Aug 29 2017, 6:10 PM

Actually, I'd like to get it documented somehow so people can try it out. I think we can gate it with an experimental config flag.

In D470#9100, @quark wrote:

Actually, I'd like to get it documented somehow so people can try it out. I think we can gate it with an experimental config flag.

Sounds good.

quark edited the summary of this revision. (Show Details)Aug 29 2017, 9:40 PM
quark updated this revision to Diff 1419.

I'm dropping the documentation from this patch and queuing this and its descendants mostly because I depend on D527 for an internal release. I hope you don't mind too much.

hgext/rebase.py
633

Will this still be visible even if the config is off?

This revision was automatically updated to reflect the committed changes.
quark added a comment.Aug 30 2017, 3:58 PM

Thanks! I think we can add documentation later.

hgext/rebase.py
633

Good catch.