From 84081a572745708577bd47746f2564a3ec29382a Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Fri, 17 Sep 2021 23:49:29 -0700 Subject: [PATCH] cli: use new helper for updating branches after committing working copy This makes conflicted branches pointing to the working copy get updated when the working copy changes, just like they are when it changes for other reason (such as `jj describe`). --- src/commands.rs | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/src/commands.rs b/src/commands.rs index 07c8dd221..dcbb78578 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -383,35 +383,7 @@ impl RepoCommandHelper { mut_repo.set_checkout(commit.id().clone()); // Update branches pointing to the old checkout - let mut branches_to_update = HashSet::new(); - for (branch_name, branch_target) in mut_repo.view().branches() { - match &branch_target.local_target { - None => { - // nothing to do (a deleted branch doesn't need - // updating) - } - Some(RefTarget::Normal(current_target)) => { - if current_target == old_checkout { - branches_to_update.insert(branch_name.clone()); - } - } - Some(RefTarget::Conflict { adds, .. }) => { - for current_target in adds { - if current_target == old_checkout { - writeln!( - ui, - "Branch {}'s target was rewritten, but not updating it \ - since it's conflicted", - branch_name - )?; - } - } - } - } - } - for branch_name in branches_to_update { - mut_repo.set_local_branch(branch_name, RefTarget::Normal(commit.id().clone())); - } + update_branches_after_rewrite(mut_repo); // Evolve descendants (though it currently evolves all commits) let evolve_result = evolve_orphans(&self.settings, mut_repo)?;