fix(update): Remove locking message for --precise

We aren't locking to latest.
We could customize the message for precise but it seemed a bit
excessive.
This commit is contained in:
Ed Page 2024-04-15 13:00:34 -05:00
parent e772fc93b4
commit bec36fce99
7 changed files with 12 additions and 23 deletions

View file

@ -170,7 +170,13 @@ pub fn update_lockfile(ws: &Workspace<'_>, opts: &UpdateOptions<'_>) -> CargoRes
true, 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 { if opts.dry_run {
opts.gctx opts.gctx
.shell() .shell()
@ -356,11 +362,14 @@ fn print_lockfile_updates(
ws: &Workspace<'_>, ws: &Workspace<'_>,
previous_resolve: &Resolve, previous_resolve: &Resolve,
resolve: &Resolve, resolve: &Resolve,
precise: bool,
registry: &mut PackageRegistry<'_>, registry: &mut PackageRegistry<'_>,
) -> CargoResult<()> { ) -> CargoResult<()> {
let diff = PackageDiff::diff(&previous_resolve, &resolve); let diff = PackageDiff::diff(&previous_resolve, &resolve);
let num_pkgs: usize = diff.iter().map(|d| d.added.len()).sum(); 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; let mut unchanged_behind = 0;
for diff in diff { for diff in diff {

View file

@ -1590,6 +1590,7 @@ fn index_version_filtering() {
.with_stderr( .with_stderr(
"\ "\
[UPDATING] [..] [UPDATING] [..]
[LOCKING] 2 packages to latest compatible versions
[ADDING] artifact v1.0.0 [ADDING] artifact v1.0.0
[UPDATING] bar v1.0.0 -> v1.0.1", [UPDATING] bar v1.0.0 -> v1.0.1",
) )

View file

@ -799,7 +799,6 @@ Caused by:
.arg(&old_head.to_string()) .arg(&old_head.to_string())
.with_stderr( .with_stderr(
"\ "\
[LOCKING] 1 package to latest compatible version
[UPDATING] bar v0.5.0 [..]", [UPDATING] bar v0.5.0 [..]",
) )
.run(); .run();

View file

@ -702,7 +702,6 @@ fn main(){
.with_status(0) .with_status(0)
.with_stderr( .with_stderr(
"\ "\
[LOCKING] 1 package to latest compatible version
[DOWNGRADING] present_dep v1.2.9 -> v1.2.3 [DOWNGRADING] present_dep v1.2.9 -> v1.2.3
", ",
) )

View file

@ -65,7 +65,6 @@ fn update_pre_release() {
.masquerade_as_nightly_cargo(&["precise-pre-release"]) .masquerade_as_nightly_cargo(&["precise-pre-release"])
.with_stderr( .with_stderr(
r#"[UPDATING] `dummy-registry` index r#"[UPDATING] `dummy-registry` index
[LOCKING] 1 package to latest compatible version
[UPDATING] my-dependency v0.1.1 -> v0.1.2-pre.0 [UPDATING] my-dependency v0.1.1 -> v0.1.2-pre.0
"#, "#,
) )
@ -99,7 +98,6 @@ fn update_pre_release_differ() {
.masquerade_as_nightly_cargo(&["precise-pre-release"]) .masquerade_as_nightly_cargo(&["precise-pre-release"])
.with_stderr( .with_stderr(
r#"[UPDATING] `dummy-registry` index r#"[UPDATING] `dummy-registry` index
[LOCKING] 1 package to latest compatible version
[DOWNGRADING] my-dependency v0.1.2 -> v0.1.2-pre.0 [DOWNGRADING] my-dependency v0.1.2 -> v0.1.2-pre.0
"#, "#,
) )
@ -109,7 +107,6 @@ fn update_pre_release_differ() {
.masquerade_as_nightly_cargo(&["precise-pre-release"]) .masquerade_as_nightly_cargo(&["precise-pre-release"])
.with_stderr( .with_stderr(
r#"[UPDATING] `dummy-registry` index 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 [UPDATING] my-dependency v0.1.2-pre.0 -> v0.1.2-pre.1
"#, "#,
) )

View file

@ -996,7 +996,6 @@ fn update_lockfile() {
.with_stderr( .with_stderr(
"\ "\
[UPDATING] `[..]` index [UPDATING] `[..]` index
[LOCKING] 1 package to latest compatible version
[UPDATING] bar v0.0.1 -> v0.0.2 [UPDATING] bar v0.0.1 -> v0.0.2
", ",
) )
@ -3776,7 +3775,6 @@ fn differ_only_by_metadata_with_lockfile() {
.with_stderr( .with_stderr(
"\ "\
[UPDATING] [..] index [UPDATING] [..] index
[LOCKING] 1 package to latest compatible version
[..] baz v0.0.1+c -> v0.0.1+b [..] baz v0.0.1+c -> v0.0.1+b
", ",
) )

View file

@ -405,7 +405,6 @@ fn update_precise() {
.with_stderr( .with_stderr(
"\ "\
[UPDATING] `[..]` index [UPDATING] `[..]` index
[LOCKING] 1 package to latest compatible version
[DOWNGRADING] serde v0.2.1 -> v0.2.0 [DOWNGRADING] serde v0.2.1 -> v0.2.0
[NOTE] pass `--verbose` to see 1 unchanged dependencies behind latest [NOTE] pass `--verbose` to see 1 unchanged dependencies behind latest
", ",
@ -496,7 +495,6 @@ fn update_precise_build_metadata() {
.with_stderr( .with_stderr(
"\ "\
[UPDATING] `[..]` index [UPDATING] `[..]` index
[LOCKING] 1 package to latest compatible version
[UPDATING] serde v0.0.1+first -> v0.0.1+second [UPDATING] serde v0.0.1+first -> v0.0.1+second
", ",
) )
@ -508,7 +506,6 @@ fn update_precise_build_metadata() {
.with_stderr( .with_stderr(
"\ "\
[UPDATING] `[..]` index [UPDATING] `[..]` index
[LOCKING] 1 package to latest compatible version
[UPDATING] serde v0.0.1+second -> v0.0.1+first [UPDATING] serde v0.0.1+second -> v0.0.1+first
", ",
) )
@ -546,7 +543,6 @@ fn update_precise_do_not_force_update_deps() {
.with_stderr( .with_stderr(
"\ "\
[UPDATING] `[..]` index [UPDATING] `[..]` index
[LOCKING] 1 package to latest compatible version
[UPDATING] serde v0.2.1 -> v0.2.2 [UPDATING] serde v0.2.1 -> v0.2.2
[NOTE] pass `--verbose` to see 1 unchanged dependencies behind latest [NOTE] pass `--verbose` to see 1 unchanged dependencies behind latest
", ",
@ -702,7 +698,6 @@ fn update_precise_first_run() {
.with_stderr( .with_stderr(
"\ "\
[UPDATING] `[..]` index [UPDATING] `[..]` index
[LOCKING] 1 package to latest compatible version
[DOWNGRADING] serde v0.2.1 -> v0.2.0 [DOWNGRADING] serde v0.2.1 -> v0.2.0
", ",
) )
@ -857,7 +852,6 @@ fn update_precise_first_run() {
.with_stderr( .with_stderr(
"\ "\
[UPDATING] `[..]` index [UPDATING] `[..]` index
[LOCKING] 0 packages to latest compatible versions
", ",
) )
.run(); .run();
@ -1024,7 +1018,6 @@ required by package `foo v0.1.0 ([ROOT]/foo)`
.with_stderr( .with_stderr(
"\ "\
[UPDATING] [..] index [UPDATING] [..] index
[LOCKING] 1 package to latest compatible version
[UPDATING] bar v0.1.0+extra-stuff.0 -> v0.1.1+extra-stuff.1 [UPDATING] bar v0.1.0+extra-stuff.0 -> v0.1.1+extra-stuff.1
", ",
) )
@ -1047,7 +1040,6 @@ required by package `foo v0.1.0 ([ROOT]/foo)`
.with_stderr( .with_stderr(
"\ "\
[UPDATING] [..] index [UPDATING] [..] index
[LOCKING] 1 package to latest compatible version
[UPDATING] bar v0.1.1+extra-stuff.1 -> v0.1.3 [UPDATING] bar v0.1.1+extra-stuff.1 -> v0.1.3
", ",
) )
@ -1379,7 +1371,6 @@ fn update_precise_git_revisions() {
.with_stderr(format!( .with_stderr(format!(
"\ "\
[UPDATING] git repository `{url}` [UPDATING] git repository `{url}`
[LOCKING] 1 package to latest compatible version
[UPDATING] git v0.5.0 ([..]) -> #{}", [UPDATING] git v0.5.0 ([..]) -> #{}",
&tag_commit_id[..8], &tag_commit_id[..8],
)) ))
@ -1393,7 +1384,6 @@ fn update_precise_git_revisions() {
.with_stderr(format!( .with_stderr(format!(
"\ "\
[UPDATING] git repository `{url}` [UPDATING] git repository `{url}`
[LOCKING] 1 package to latest compatible version
[UPDATING] git v0.5.0 ([..]) -> #{short_id}", [UPDATING] git v0.5.0 ([..]) -> #{short_id}",
)) ))
.run(); .run();
@ -1408,7 +1398,6 @@ fn update_precise_git_revisions() {
.with_stderr(format!( .with_stderr(format!(
"\ "\
[UPDATING] git repository `{url}` [UPDATING] git repository `{url}`
[LOCKING] 1 package to latest compatible version
[UPDATING] git v0.5.0 ([..]) -> #{}", [UPDATING] git v0.5.0 ([..]) -> #{}",
&tag_commit_id[..8], &tag_commit_id[..8],
)) ))
@ -1427,7 +1416,6 @@ fn update_precise_git_revisions() {
.with_stderr(format!( .with_stderr(format!(
"\ "\
[UPDATING] git repository `{url}` [UPDATING] git repository `{url}`
[LOCKING] 1 package to latest compatible version
[UPDATING] git v0.5.0 ([..]) -> #{}", [UPDATING] git v0.5.0 ([..]) -> #{}",
&head_id[..8], &head_id[..8],
)) ))
@ -1487,7 +1475,6 @@ Caused by:
[UPDATING] `dummy-registry` index [UPDATING] `dummy-registry` index
[WARNING] selected package `bar@0.1.1` was yanked by the author [WARNING] selected package `bar@0.1.1` was yanked by the author
[NOTE] if possible, try a compatible non-yanked version [NOTE] if possible, try a compatible non-yanked version
[LOCKING] 1 package to latest compatible version
[UPDATING] bar v0.1.0 -> v0.1.1 [UPDATING] bar v0.1.0 -> v0.1.1
", ",
) )
@ -1531,7 +1518,6 @@ fn precise_yanked_multiple_presence() {
[UPDATING] `dummy-registry` index [UPDATING] `dummy-registry` index
[WARNING] selected package `bar@0.1.1` was yanked by the author [WARNING] selected package `bar@0.1.1` was yanked by the author
[NOTE] if possible, try a compatible non-yanked version [NOTE] if possible, try a compatible non-yanked version
[LOCKING] 1 package to latest compatible version
[UPDATING] bar v0.1.0 -> v0.1.1 [UPDATING] bar v0.1.0 -> v0.1.1
", ",
) )