wok_dev/cmd/head/
switch.rs

1use anyhow::*;
2
3use crate::{config, repo};
4
5pub fn switch(wok_config: &mut config::Config, umbrella: &repo::Repo) -> Result<bool> {
6    let mut config_updated = false;
7
8    for subrepo in umbrella.subrepos.iter() {
9        subrepo.switch(&umbrella.head)?;
10        config_updated |= wok_config.set_repo_head(
11            subrepo.work_dir.strip_prefix(&umbrella.work_dir)?,
12            &umbrella.head,
13        );
14    }
15
16    Ok(config_updated)
17}