The test shows that rebase moves "D" twice while it could have moved it only
once. It is a side effect when I spent 1.5 hours on investigating a user
report that a commit was duplicated with amend --rebase somehow. I didn't
have conclusion about that report (maybe it's because old inhibit was
used?), but thought it's nice to have this interesting test case added.
If hg rebase -r C -d B2 -q were moved after hg commit --amend -m B3,
then restack will move "D" only once.
It can be solved by using another topo sort, which was planned in the
multi-dest series [1].
[1]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-June/100247.html