use std::path::Path;
use crate::error::Result;
use crate::lockfile;
pub fn cmd_lock_migrate(repo_root: &Path) -> Result<()> {
let path = lockfile::project_lockfile(repo_root);
let lock = lockfile::read_lockfile_at(&path)?;
if lock.version == lockfile::LOCKFILE_VERSION {
println!(
"{} is already schema version {}",
path.display(),
lockfile::LOCKFILE_VERSION
);
return Ok(());
}
lockfile::write_lockfile_at(&path, &lock)?;
println!(
"migrated {} from schema version {} to {}",
path.display(),
lock.version,
lockfile::LOCKFILE_VERSION
);
Ok(())
}