From f88e8b6086d16a73141a53c7d803025a19111dc8 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Sat, 2 Jan 2021 20:15:21 -0800 Subject: [PATCH] evolve: update working copy at end (if applicable) The `evolve` command had TODOs about making it update the checkout and the working copy after evolving commits. I've been running into that (being left on an obsolete commit) quite often while dogfooding, so let's fix it. --- src/commands.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/commands.rs b/src/commands.rs index 24ad5f3c7..20d9e8a6f 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -1616,7 +1616,8 @@ fn cmd_evolve<'s>( matches: &ArgMatches, _sub_matches: &ArgMatches, ) -> Result<(), CommandError> { - let repo = get_repo(ui, &matches)?; + let mut repo = get_repo(ui, &matches)?; + let owned_wc = repo.working_copy().clone(); struct Listener<'a, 's, 'r> { ui: &'a mut Ui<'s>, @@ -1676,9 +1677,13 @@ fn cmd_evolve<'s>( }; let mut tx = repo.start_transaction("evolve"); evolve(&user_settings, &mut tx, &mut listener); - // TODO: update checkout + update_checkout_after_rewrite(ui, &mut tx); tx.commit(); - // TODO: update working copy + update_working_copy( + ui, + Arc::get_mut(&mut repo).unwrap(), + &owned_wc.lock().unwrap(), + )?; Ok(()) }