Martin von Zweigbergk <martinvonz@google.com> [Tue, 23 Mar 2021 22:48:27 -0700] rev 46837
rebase: don't call rewriteutil.precheck() with to-be-skipped commits
It's clearly incorrect to call `rewriteutil.precheck()` for commits
that we're not about to rewrite. We haven't noticed yet because the
function doesn't check for divergence, but I'm about to teach it to do
that.
Differential Revision: https://phab.mercurial-scm.org/D10259
Martin von Zweigbergk <martinvonz@google.com> [Tue, 23 Mar 2021 14:15:40 -0700] rev 46836
reabase: call rewriteutil.precheck() a bit later
We now filter out descendants of divergence-causing commits in
`_handleskippingobsolete()`. The filtered-out commits are removed from
the rebase set (`destmap` and `state`). We should therefore call
`rewriteutil.precheck()` after `_handleskippingobsolete()`. This patch
does that. It hasn't mattered so far because `rewriteutil.precheck()`
doesn't yet check for divergence, but it will soon.
This affects one test where we now fail because the user is trying to
rebase an ancestor instead of failing because they tried to rebase a
public commit. We have several similar tests just after, where we
still fail because of the phase, so that seems fine. The difference in
behavior also seems fine to me.
Differential Revision: https://phab.mercurial-scm.org/D10258
Martin von Zweigbergk <martinvonz@google.com> [Tue, 23 Mar 2021 14:49:31 -0700] rev 46835
rebase: set `prepared = True` at very end of `_preparenewrebase()`
Once we've set `rebaseruntime.prepared = True`, `rebaseruntime.repo`
starts returning the unfiltered repo. That will make my next patch
break, because that patch moves the call to `rewriteutil.precheck()`
after the call to `_handleskippingobsolete()`, which current happens
after `prepared = True`. We therefore need to prepare by moving
`prepared = True` a bit later, after `_handleskippingobsolete()`. I
don't think that matters for that call.
Differential Revision: https://phab.mercurial-scm.org/D10257