Page MenuHomePhabricator

rebase: skip *all* obsolete revisions, just warn about divergence
Needs ReviewPublic

Authored by martinvonz on Aug 28 2018, 3:33 AM.


Group Reviewers

We already skip obsolete revisions in some case: if there is no
successor, or when the successor is in the rebase set or in the
destination, I think. However, we instead error out if the successor
is elsewhere (e.g. a child or a sibling of the destination), because
it would cause divergence. The previous commit fixed one specific case
of this.

Consider this history (based on a test case updated by this patch):

o  D
| o  B'
| o  C
| |
| x  B
o A

If the user now runs hg rebase -s B -d D we would error out and tell
them that it would cause divergence from B. This patch makes it so we
instead ignore B and C (and tell the user that we're doing that
because it would cause divergence). I think this simpler model will be
easier for users to understand (I had also thought that all obsolete
commits and their descendants were skipped until we got reports from
users that that wasn't the case).

Note that we still skip just the obsolete (not its descendants) if
it's a prune or if the successor is in the destination.

This should also let us simplify the source quite a bit. I'll do that
in later commits after I've heard people's thoughts on this one.

Diff Detail

rHG Mercurial
Lint Skipped
Unit Tests Skipped

Event Timeline

martinvonz created this revision.Aug 28 2018, 3:33 AM
martinvonz edited the summary of this revision. (Show Details)Aug 28 2018, 11:13 AM
martinvonz edited the summary of this revision. (Show Details)
martinvonz edited the summary of this revision. (Show Details)Aug 28 2018, 12:46 PM
martinvonz retitled this revision from rebase: skip *all* obsolete revisions to rebase: skip *all* obsolete revisions, just warn about divergence.
yuja added a subscriber: yuja.Aug 29 2018, 8:55 AM

@@ -1289,18 +1286,16 @@

o  0:b173517d0057 a
$ hg rebase -d 0 -r 2
  • rebasing 2:a82ac2b38757 "c" (c)

+ note: not rebasing 2:a82ac2b38757 "c" (c) and its descendants as this would cause divergence

Looks like the fix for issue5782 regressed.

Changing the behavior of --src to ignore obsolete and orphan unrelated to the destination seems like a good idea.

However, this change seems to also affect --rev. The --rev allow for a precise selection of what the user wants to see rebased and it feels like we should stick to the user wishes here. Dropping explicitly selected revisions feels wrong and will make some use cases harder to perform.