cargo::ops

Function write_manifest_upgrades

source
pub fn write_manifest_upgrades(
    ws: &Workspace<'_>,
    upgrades: &HashMap<(String, SourceId), Version>,
    dry_run: bool,
) -> CargoResult<bool>
Expand description

Update manifests with upgraded versions, and write to disk. Based on cargo-edit. Returns true if any file has changed.

Some of the checks here are duplicating checks already done in upgrade_manifests/upgrade_dependency. Why? Let’s say upgrade_dependency has found that dependency foo was eligible for an upgrade. But foo can occur in multiple manifest files, and even multiple times in the same manifest file, and may be pinned, renamed, etc. in some of the instances. So we still need to check here which dependencies to actually modify. So why not drop the upgrade map and redo all checks here? Because then we’d have to query the registries again to find the latest versions.