Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(upgrade): Make pinned skipping the default #735

Merged
merged 1 commit into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ OPTIONS:
--manifest-path <PATH> Path to the manifest to upgrade
--offline Run without accessing the network
-p, --package <PKGID> 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
Expand Down
7 changes: 3 additions & 4 deletions src/bin/upgrade/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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!(
Expand Down
2 changes: 1 addition & 1 deletion tests/cmd/upgrade/exclude_dep.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bin.name = "cargo-upgrade"
args = ["upgrade", "--exclude", "docopt", "--verbose"]
args = ["upgrade", "--pinned", "--exclude", "docopt", "--verbose"]
status = "success"
stdout = ""
stderr = """
Expand Down
2 changes: 1 addition & 1 deletion tests/cmd/upgrade/exclude_renamed.out/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/cmd/upgrade/exclude_renamed.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bin.name = "cargo-upgrade"
args = ["upgrade", "--skip-pinned", "--verbose"]
args = ["upgrade", "--verbose"]
status = "success"
stdout = ""
stderr = """
Expand Down
2 changes: 1 addition & 1 deletion tests/cmd/upgrade/preserve_precision_major.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bin.name = "cargo-upgrade"
args = ["upgrade", "--verbose"]
args = ["upgrade", "--pinned", "--verbose"]
status = "success"
stdout = ""
stderr = """
Expand Down
2 changes: 1 addition & 1 deletion tests/cmd/upgrade/preserve_precision_minor.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bin.name = "cargo-upgrade"
args = ["upgrade", "--verbose"]
args = ["upgrade", "--pinned", "--verbose"]
status = "success"
stdout = ""
stderr = """
Expand Down
2 changes: 1 addition & 1 deletion tests/cmd/upgrade/preserve_precision_patch.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bin.name = "cargo-upgrade"
args = ["upgrade", "--verbose"]
args = ["upgrade", "--pinned", "--verbose"]
status = "success"
stdout = ""
stderr = """
Expand Down
2 changes: 1 addition & 1 deletion tests/cmd/upgrade/upgrade_everything.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bin.name = "cargo-upgrade"
args = ["upgrade"]
args = ["upgrade", "--pinned"]
status = "success"
stdout = ""
stderr = """
Expand Down
2 changes: 1 addition & 1 deletion tests/cmd/upgrade/upgrade_renamed.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bin.name = "cargo-upgrade"
args = ["upgrade", "--verbose"]
args = ["upgrade", "--pinned", "--verbose"]
status = "success"
stdout = ""
stderr = """
Expand Down