Skip to content

Commit

Permalink
Merge pull request #736 from epage/path
Browse files Browse the repository at this point in the history
fix(upgrade): `--to-lockfile` changes all sources
  • Loading branch information
epage authored Jul 14, 2022
2 parents b76df5d + fad203e commit 230b3cc
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/bin/upgrade/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,8 @@ fn exec(args: UpgradeArgs) -> CargoResult<()> {
continue;
}
};
let old_version_req = match dependency.source.as_ref().and_then(|s| s.as_registry())
{
Some(registry) => registry.version.clone(),
let old_version_req = match dependency.version() {
Some(version_req) => version_req.to_owned(),
None => {
args.verbose(|| {
let source = dependency
Expand All @@ -200,7 +199,7 @@ fn exec(args: UpgradeArgs) -> CargoResult<()> {
shell_warn(&format!(
"ignoring {}, source is {}",
dependency.toml_key(),
source
source,
))
})?;
continue;
Expand Down Expand Up @@ -253,6 +252,25 @@ fn exec(args: UpgradeArgs) -> CargoResult<()> {
}
}
} else {
if dependency
.source
.as_ref()
.and_then(|s| s.as_registry())
.is_none()
{
args.verbose(|| {
let source = dependency
.source()
.map(|s| s.to_string())
.unwrap_or_else(|| "unknown".to_owned());
shell_warn(&format!(
"ignoring {}, source is {}",
dependency.toml_key(),
source
))
})?;
continue;
}
// Update indices for any alternative registries, unless
// we're offline.
let registry_url = dependency
Expand Down

0 comments on commit 230b3cc

Please sign in to comment.