cli: also update descendant branches after rewriting working copy commit
After writing a new working copy commit, we update branches pointing
to it, and we rebase descendants on top. However, we should be doing
that in the opposite order, so the branch updates apply to rewritten
descendants as well.
@@ -382,9 +382,6 @@ impl RepoCommandHelper {
.write_to_repo(mut_repo);
mut_repo.set_checkout(commit.id().clone());
- // Update branches pointing to the old checkout
- update_branches_after_rewrite(mut_repo);
-
// Evolve descendants (though it currently evolves all commits)
let evolve_result = evolve_orphans(&self.settings, mut_repo)?;
if evolve_result.num_resolved > 0 {
@@ -403,6 +400,10 @@ impl RepoCommandHelper {
)?;
}
+ // Update branches pointing to the old checkout and any branches pointing to
+ // descendants.
+ update_branches_after_rewrite(mut_repo);
+
self.repo = tx.commit();
locked_wc.finish(commit);
} else {
