1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use crate::{
registry::{redep, Registry},
result::{Error, Result},
};
use std::path::PathBuf;
pub fn exec(path: PathBuf, mut tag: String, update: bool) -> Result<()> {
let registry = Registry::new()?;
if update {
println!("Fetching registry...");
registry.update()?;
}
let tags = registry.tag()?;
if tag.is_empty() && tags.len() > 0 {
tag = tags[tags.len() - 1].clone();
} else if !tags.contains(&tag) {
return Err(Error::Sup(format!(
"The registry at {} doesn't have tag {}",
registry.0, tag,
)));
}
registry.checkout(&tag)?;
let crates = etc::find_all(path, "Cargo.toml")?;
for ct in crates {
redep(&ct, ®istry)?;
}
registry.checkout("master")?;
Ok(())
}