From a9831821e490902e86d534177645faf929c2238b Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 14 Jul 2022 14:33:46 -0500 Subject: [PATCH] fix(upgrade): Make pinned skipping the default --- README.md | 4 +--- src/bin/upgrade/upgrade.rs | 7 +++---- tests/cmd/upgrade/exclude_dep.toml | 2 +- tests/cmd/upgrade/exclude_renamed.out/Cargo.toml | 2 +- tests/cmd/upgrade/exclude_renamed.toml | 2 +- tests/cmd/upgrade/{skip_pinned.in => pinned.in}/Cargo.toml | 0 tests/cmd/upgrade/{skip_pinned.in => pinned.in}/src/lib.rs | 0 .../cmd/upgrade/{skip_pinned.out => pinned.out}/Cargo.toml | 0 .../cmd/upgrade/{skip_pinned.out => pinned.out}/src/lib.rs | 0 tests/cmd/upgrade/{skip_pinned.toml => pinned.toml} | 2 +- tests/cmd/upgrade/preserve_precision_major.toml | 2 +- tests/cmd/upgrade/preserve_precision_minor.toml | 2 +- tests/cmd/upgrade/preserve_precision_patch.toml | 2 +- tests/cmd/upgrade/upgrade_everything.toml | 2 +- tests/cmd/upgrade/upgrade_renamed.toml | 2 +- 15 files changed, 13 insertions(+), 16 deletions(-) rename tests/cmd/upgrade/{skip_pinned.in => pinned.in}/Cargo.toml (100%) rename tests/cmd/upgrade/{skip_pinned.in => pinned.in}/src/lib.rs (100%) rename tests/cmd/upgrade/{skip_pinned.out => pinned.out}/Cargo.toml (100%) rename tests/cmd/upgrade/{skip_pinned.out => pinned.out}/src/lib.rs (100%) rename tests/cmd/upgrade/{skip_pinned.toml => pinned.toml} (92%) diff --git a/README.md b/README.md index 256e027713..5aac5ba0e7 100644 --- a/README.md +++ b/README.md @@ -154,9 +154,7 @@ OPTIONS: --manifest-path Path to the manifest to upgrade --offline Run without accessing the network -p, --package Package id of the crate to add this dependency to - --skip-pinned Only update a dependency if it is not currently pinned in the - manifest. "Pinned" refers to dependencies with a '=' or '<' or - '<=' version requirement + --pinned Upgrade dependencies pinned in the manifest --to-lockfile Upgrade all packages to the version in the lockfile -v, --verbose Use verbose output -V, --version Print version information diff --git a/src/bin/upgrade/upgrade.rs b/src/bin/upgrade/upgrade.rs index 9fe26a272a..a4bf076682 100644 --- a/src/bin/upgrade/upgrade.rs +++ b/src/bin/upgrade/upgrade.rs @@ -67,10 +67,9 @@ pub struct UpgradeArgs { #[clap(long)] dry_run: bool, - /// Only update a dependency if it is not currently pinned in the manifest. - /// "Pinned" refers to dependencies with a '=' or '<' or '<=' version requirement + /// Upgrade dependencies pinned in the manifest. #[clap(long)] - skip_pinned: bool, + pinned: bool, /// Run without accessing the network #[clap(long)] @@ -207,7 +206,7 @@ fn exec(args: UpgradeArgs) -> CargoResult<()> { continue; } }; - if args.skip_pinned { + if !args.pinned { if dependency.rename.is_some() { args.verbose(|| { shell_warn(&format!( diff --git a/tests/cmd/upgrade/exclude_dep.toml b/tests/cmd/upgrade/exclude_dep.toml index c8ac35ee94..a73a12ed99 100644 --- a/tests/cmd/upgrade/exclude_dep.toml +++ b/tests/cmd/upgrade/exclude_dep.toml @@ -1,5 +1,5 @@ bin.name = "cargo-upgrade" -args = ["upgrade", "--exclude", "docopt", "--verbose"] +args = ["upgrade", "--pinned", "--exclude", "docopt", "--verbose"] status = "success" stdout = "" stderr = """ diff --git a/tests/cmd/upgrade/exclude_renamed.out/Cargo.toml b/tests/cmd/upgrade/exclude_renamed.out/Cargo.toml index 20f8e0e820..62a598d5af 100644 --- a/tests/cmd/upgrade/exclude_renamed.out/Cargo.toml +++ b/tests/cmd/upgrade/exclude_renamed.out/Cargo.toml @@ -6,7 +6,7 @@ version = "0.0.0" path = "dummy.rs" [dependencies] -te = { package = "toml_edit", version = "99999.0.0" } +te = { package = "toml_edit", version = "0.1.5" } [dependencies.rx] package = "regex" diff --git a/tests/cmd/upgrade/exclude_renamed.toml b/tests/cmd/upgrade/exclude_renamed.toml index 17557182ba..0bc9cc6e95 100644 --- a/tests/cmd/upgrade/exclude_renamed.toml +++ b/tests/cmd/upgrade/exclude_renamed.toml @@ -4,7 +4,7 @@ status = "success" stdout = "" stderr = """ Checking cargo-list-test-fixture's dependencies - Upgrading te: v0.1.5 -> v99999.0.0 +warning: ignoring te, renamed dependencies are pinned warning: ignoring rx, excluded by user """ fs.sandbox = true diff --git a/tests/cmd/upgrade/skip_pinned.in/Cargo.toml b/tests/cmd/upgrade/pinned.in/Cargo.toml similarity index 100% rename from tests/cmd/upgrade/skip_pinned.in/Cargo.toml rename to tests/cmd/upgrade/pinned.in/Cargo.toml diff --git a/tests/cmd/upgrade/skip_pinned.in/src/lib.rs b/tests/cmd/upgrade/pinned.in/src/lib.rs similarity index 100% rename from tests/cmd/upgrade/skip_pinned.in/src/lib.rs rename to tests/cmd/upgrade/pinned.in/src/lib.rs diff --git a/tests/cmd/upgrade/skip_pinned.out/Cargo.toml b/tests/cmd/upgrade/pinned.out/Cargo.toml similarity index 100% rename from tests/cmd/upgrade/skip_pinned.out/Cargo.toml rename to tests/cmd/upgrade/pinned.out/Cargo.toml diff --git a/tests/cmd/upgrade/skip_pinned.out/src/lib.rs b/tests/cmd/upgrade/pinned.out/src/lib.rs similarity index 100% rename from tests/cmd/upgrade/skip_pinned.out/src/lib.rs rename to tests/cmd/upgrade/pinned.out/src/lib.rs diff --git a/tests/cmd/upgrade/skip_pinned.toml b/tests/cmd/upgrade/pinned.toml similarity index 92% rename from tests/cmd/upgrade/skip_pinned.toml rename to tests/cmd/upgrade/pinned.toml index 60b07f15bc..de2b15700b 100644 --- a/tests/cmd/upgrade/skip_pinned.toml +++ b/tests/cmd/upgrade/pinned.toml @@ -1,5 +1,5 @@ bin.name = "cargo-upgrade" -args = ["upgrade", "--skip-pinned", "--verbose"] +args = ["upgrade", "--verbose"] status = "success" stdout = "" stderr = """ diff --git a/tests/cmd/upgrade/preserve_precision_major.toml b/tests/cmd/upgrade/preserve_precision_major.toml index 59b3f10d3b..f690f98626 100644 --- a/tests/cmd/upgrade/preserve_precision_major.toml +++ b/tests/cmd/upgrade/preserve_precision_major.toml @@ -1,5 +1,5 @@ bin.name = "cargo-upgrade" -args = ["upgrade", "--verbose"] +args = ["upgrade", "--pinned", "--verbose"] status = "success" stdout = "" stderr = """ diff --git a/tests/cmd/upgrade/preserve_precision_minor.toml b/tests/cmd/upgrade/preserve_precision_minor.toml index ac17a702d6..880255014b 100644 --- a/tests/cmd/upgrade/preserve_precision_minor.toml +++ b/tests/cmd/upgrade/preserve_precision_minor.toml @@ -1,5 +1,5 @@ bin.name = "cargo-upgrade" -args = ["upgrade", "--verbose"] +args = ["upgrade", "--pinned", "--verbose"] status = "success" stdout = "" stderr = """ diff --git a/tests/cmd/upgrade/preserve_precision_patch.toml b/tests/cmd/upgrade/preserve_precision_patch.toml index ab902764ae..aee35058d8 100644 --- a/tests/cmd/upgrade/preserve_precision_patch.toml +++ b/tests/cmd/upgrade/preserve_precision_patch.toml @@ -1,5 +1,5 @@ bin.name = "cargo-upgrade" -args = ["upgrade", "--verbose"] +args = ["upgrade", "--pinned", "--verbose"] status = "success" stdout = "" stderr = """ diff --git a/tests/cmd/upgrade/upgrade_everything.toml b/tests/cmd/upgrade/upgrade_everything.toml index 9b38270a57..2dc65dad4c 100644 --- a/tests/cmd/upgrade/upgrade_everything.toml +++ b/tests/cmd/upgrade/upgrade_everything.toml @@ -1,5 +1,5 @@ bin.name = "cargo-upgrade" -args = ["upgrade"] +args = ["upgrade", "--pinned"] status = "success" stdout = "" stderr = """ diff --git a/tests/cmd/upgrade/upgrade_renamed.toml b/tests/cmd/upgrade/upgrade_renamed.toml index b2da2a213e..21490f413d 100644 --- a/tests/cmd/upgrade/upgrade_renamed.toml +++ b/tests/cmd/upgrade/upgrade_renamed.toml @@ -1,5 +1,5 @@ bin.name = "cargo-upgrade" -args = ["upgrade", "--verbose"] +args = ["upgrade", "--pinned", "--verbose"] status = "success" stdout = "" stderr = """