rebase: don't use rebased node as dirstate p2 (BC)

Authored by martinvonz.


rebase: don't use rebased node as dirstate p2 (BC)

When rebasing a node, we currently use the rebased node as p2 in the
dirstate until just before we commit it (we then change to the desired
parents). This p2 is visible to the user when the rebase gets
interrupted because of merge conflicts. That can be useful to the user
as a reminder of which commit is currently being rebased, but I
believe it's incorrect for a few reasons:

  • I think the dirstate parents should be the ones that will be set when the commit is created.
  • I think having two parents means that you're merging those two commits, but when rebasing, you're generally grafting, not merging.
  • When rebasing a merge commit, we should use the two desired parents as dirstate parents (and we clearly can't have the rebased node as a third dirstate parent).
  • hg graft (and hg update --merge) sets only one parent and hg rebase should be consistent with that.

I realize that this is a somewhat large user-visible change, but I
think it's worth it because it will simplify things quite a bit.

Differential Revision: https://phab.mercurial-scm.org/D7827