Skip to content

Commit

Permalink
fix(update): Remove locking message for --precise
Browse files Browse the repository at this point in the history
We aren't locking to latest.
We could customize the message for precise but it seemed a bit
excessive.
  • Loading branch information
epage committed Apr 15, 2024
1 parent e772fc9 commit e188d39
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 23 deletions.
13 changes: 11 additions & 2 deletions src/cargo/ops/cargo_generate_lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,13 @@ pub fn update_lockfile(ws: &Workspace<'_>, opts: &UpdateOptions<'_>) -> CargoRes
true,
)?;

print_lockfile_updates(ws, &previous_resolve, &resolve, &mut registry)?;
print_lockfile_updates(
ws,
&previous_resolve,
&resolve,
opts.precise.is_some(),
&mut registry,
)?;
if opts.dry_run {
opts.gctx
.shell()
Expand Down Expand Up @@ -356,11 +362,14 @@ fn print_lockfile_updates(
ws: &Workspace<'_>,
previous_resolve: &Resolve,
resolve: &Resolve,
precise: bool,
registry: &mut PackageRegistry<'_>,
) -> CargoResult<()> {
let diff = PackageDiff::diff(&previous_resolve, &resolve);
let num_pkgs: usize = diff.iter().map(|d| d.added.len()).sum();
status_locking(ws, num_pkgs)?;
if !precise {
status_locking(ws, num_pkgs)?;
}

let mut unchanged_behind = 0;
for diff in diff {
Expand Down
1 change: 0 additions & 1 deletion tests/testsuite/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,6 @@ Caused by:
.arg(&old_head.to_string())
.with_stderr(
"\
[LOCKING] 1 package to latest compatible version
[UPDATING] bar v0.5.0 [..]",
)
.run();
Expand Down
1 change: 0 additions & 1 deletion tests/testsuite/offline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,6 @@ fn main(){
.with_status(0)
.with_stderr(
"\
[LOCKING] 1 package to latest compatible version
[DOWNGRADING] present_dep v1.2.9 -> v1.2.3
",
)
Expand Down
3 changes: 0 additions & 3 deletions tests/testsuite/precise_pre_release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ fn update_pre_release() {
.masquerade_as_nightly_cargo(&["precise-pre-release"])
.with_stderr(
r#"[UPDATING] `dummy-registry` index
[LOCKING] 1 package to latest compatible version
[UPDATING] my-dependency v0.1.1 -> v0.1.2-pre.0
"#,
)
Expand Down Expand Up @@ -99,7 +98,6 @@ fn update_pre_release_differ() {
.masquerade_as_nightly_cargo(&["precise-pre-release"])
.with_stderr(
r#"[UPDATING] `dummy-registry` index
[LOCKING] 1 package to latest compatible version
[DOWNGRADING] my-dependency v0.1.2 -> v0.1.2-pre.0
"#,
)
Expand All @@ -109,7 +107,6 @@ fn update_pre_release_differ() {
.masquerade_as_nightly_cargo(&["precise-pre-release"])
.with_stderr(
r#"[UPDATING] `dummy-registry` index
[LOCKING] 1 package to latest compatible version
[UPDATING] my-dependency v0.1.2-pre.0 -> v0.1.2-pre.1
"#,
)
Expand Down
2 changes: 0 additions & 2 deletions tests/testsuite/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,6 @@ fn update_lockfile() {
.with_stderr(
"\
[UPDATING] `[..]` index
[LOCKING] 1 package to latest compatible version
[UPDATING] bar v0.0.1 -> v0.0.2
",
)
Expand Down Expand Up @@ -3776,7 +3775,6 @@ fn differ_only_by_metadata_with_lockfile() {
.with_stderr(
"\
[UPDATING] [..] index
[LOCKING] 1 package to latest compatible version
[..] baz v0.0.1+c -> v0.0.1+b
",
)
Expand Down
14 changes: 0 additions & 14 deletions tests/testsuite/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ fn update_precise() {
.with_stderr(
"\
[UPDATING] `[..]` index
[LOCKING] 1 package to latest compatible version
[DOWNGRADING] serde v0.2.1 -> v0.2.0
[NOTE] pass `--verbose` to see 1 unchanged dependencies behind latest
",
Expand Down Expand Up @@ -496,7 +495,6 @@ fn update_precise_build_metadata() {
.with_stderr(
"\
[UPDATING] `[..]` index
[LOCKING] 1 package to latest compatible version
[UPDATING] serde v0.0.1+first -> v0.0.1+second
",
)
Expand All @@ -508,7 +506,6 @@ fn update_precise_build_metadata() {
.with_stderr(
"\
[UPDATING] `[..]` index
[LOCKING] 1 package to latest compatible version
[UPDATING] serde v0.0.1+second -> v0.0.1+first
",
)
Expand Down Expand Up @@ -546,7 +543,6 @@ fn update_precise_do_not_force_update_deps() {
.with_stderr(
"\
[UPDATING] `[..]` index
[LOCKING] 1 package to latest compatible version
[UPDATING] serde v0.2.1 -> v0.2.2
[NOTE] pass `--verbose` to see 1 unchanged dependencies behind latest
",
Expand Down Expand Up @@ -702,7 +698,6 @@ fn update_precise_first_run() {
.with_stderr(
"\
[UPDATING] `[..]` index
[LOCKING] 1 package to latest compatible version
[DOWNGRADING] serde v0.2.1 -> v0.2.0
",
)
Expand Down Expand Up @@ -857,7 +852,6 @@ fn update_precise_first_run() {
.with_stderr(
"\
[UPDATING] `[..]` index
[LOCKING] 0 packages to latest compatible versions
",
)
.run();
Expand Down Expand Up @@ -1024,7 +1018,6 @@ required by package `foo v0.1.0 ([ROOT]/foo)`
.with_stderr(
"\
[UPDATING] [..] index
[LOCKING] 1 package to latest compatible version
[UPDATING] bar v0.1.0+extra-stuff.0 -> v0.1.1+extra-stuff.1
",
)
Expand All @@ -1047,7 +1040,6 @@ required by package `foo v0.1.0 ([ROOT]/foo)`
.with_stderr(
"\
[UPDATING] [..] index
[LOCKING] 1 package to latest compatible version
[UPDATING] bar v0.1.1+extra-stuff.1 -> v0.1.3
",
)
Expand Down Expand Up @@ -1379,7 +1371,6 @@ fn update_precise_git_revisions() {
.with_stderr(format!(
"\
[UPDATING] git repository `{url}`
[LOCKING] 1 package to latest compatible version
[UPDATING] git v0.5.0 ([..]) -> #{}",
&tag_commit_id[..8],
))
Expand All @@ -1393,7 +1384,6 @@ fn update_precise_git_revisions() {
.with_stderr(format!(
"\
[UPDATING] git repository `{url}`
[LOCKING] 1 package to latest compatible version
[UPDATING] git v0.5.0 ([..]) -> #{short_id}",
))
.run();
Expand All @@ -1408,7 +1398,6 @@ fn update_precise_git_revisions() {
.with_stderr(format!(
"\
[UPDATING] git repository `{url}`
[LOCKING] 1 package to latest compatible version
[UPDATING] git v0.5.0 ([..]) -> #{}",
&tag_commit_id[..8],
))
Expand All @@ -1427,7 +1416,6 @@ fn update_precise_git_revisions() {
.with_stderr(format!(
"\
[UPDATING] git repository `{url}`
[LOCKING] 1 package to latest compatible version
[UPDATING] git v0.5.0 ([..]) -> #{}",
&head_id[..8],
))
Expand Down Expand Up @@ -1487,7 +1475,6 @@ Caused by:
[UPDATING] `dummy-registry` index
[WARNING] selected package `bar@0.1.1` was yanked by the author
[NOTE] if possible, try a compatible non-yanked version
[LOCKING] 1 package to latest compatible version
[UPDATING] bar v0.1.0 -> v0.1.1
",
)
Expand Down Expand Up @@ -1531,7 +1518,6 @@ fn precise_yanked_multiple_presence() {
[UPDATING] `dummy-registry` index
[WARNING] selected package `bar@0.1.1` was yanked by the author
[NOTE] if possible, try a compatible non-yanked version
[LOCKING] 1 package to latest compatible version
[UPDATING] bar v0.1.0 -> v0.1.1
",
)
Expand Down

0 comments on commit e188d39

Please sign in to comment.