jj/lib
Martin von Zweigbergk 0c8a116771 rewrite: fix auto-rebasing after "branchy" rewrites
The `DescendantRebaser` was designed to help with rebasing in two
different use cases: 1) after regular rewriting of commits where the
change ID is preserved, and 2) after importing moved branches from
other repo (e.g. backing Git repo or remote). Many of the tests are
for the second use case, such as where a branch was moved
forward. However, I just noticed that there's a pretty common scenario
from the first use case that is not supported.

Let's say you have this history:

```
D
|
C C'
|/
B B'
|/
A
```

Here we want C' to be rebased onto B' and then D to be rebased onto
C''. However, because of the support for moving branches forward, we
would not rebase commits that were already rewritten, such as C' here
(see affected tests for details), which resulted in D getting rebased
onto C', and both B and B' remaining visible.

I think I was thinking when I designed it that it would be nice if you
could just tell `DescendantRebaser` that any descendants of a commit
should be moved forward. That may be useful, but I don't think we'll
want that for the general case of a branch moving forward. Perhaps
we'll want to make it configurable which branches it should happen
for. Either way, the way it was coded by not rebasing already
rewritten commits did not work for the case above. We may be able to
handle both cases better by considering each rewrite separately
instead of all destinations at once. For now, however, I've decided to
keep it simple, so I'm fixing the case above by sacrificing some of
the potentially useful functionality for moving branches forward.

Another fix necessary for the scenario shown above was to make sure we
always rebase C' before D. Before this patch, that depended on the
order in the index. This patch fixes that by modifying the topological
order to take rewrites into account, making D depend not only on C but
also on C'. (I suppose you could instead say that C depends on both B
and C'; I don't know if that'd make a difference.)
2022-01-27 22:20:14 -08:00
..
benches project: rename project from Jujube to Jujutsu 2021-05-15 10:28:40 -07:00
protos working_copy: keep track of operation ID (#13) 2022-01-19 19:15:29 -08:00
src rewrite: fix auto-rebasing after "branchy" rewrites 2022-01-27 22:20:14 -08:00
tests rewrite: fix auto-rebasing after "branchy" rewrites 2022-01-27 22:20:14 -08:00
build.rs rustfmt: configure to group imports 2021-03-14 10:46:25 -07:00
Cargo.toml cargo: upgrade to Rust 2021 (just to stay up to date) 2021-12-13 21:47:00 -08:00