refactor(resolve): Pull put locking message

This commit is contained in:
Ed Page 2024-04-12 20:41:51 -05:00
parent 17a11e493c
commit cb2bdea521
1 changed files with 10 additions and 7 deletions

View File

@ -212,9 +212,7 @@ fn print_lockfile_generation(
// just ourself, nothing worth reporting
return Ok(());
}
ws.gctx()
.shell()
.status("Locking", format!("{num_pkgs} packages"))?;
status_locking(ws, num_pkgs)?;
for diff in diff {
fn format_latest(version: semver::Version) -> String {
@ -271,10 +269,7 @@ fn print_lockfile_sync(
if num_pkgs == 0 {
return Ok(());
}
let plural = if num_pkgs == 1 { "" } else { "s" };
ws.gctx()
.shell()
.status("Locking", format!("{num_pkgs} package{plural}"))?;
status_locking(ws, num_pkgs)?;
for diff in diff {
fn format_latest(version: semver::Version) -> String {
@ -488,6 +483,14 @@ fn print_lockfile_updates(
Ok(())
}
fn status_locking(ws: &Workspace<'_>, num_pkgs: usize) -> CargoResult<()> {
let plural = if num_pkgs == 1 { "" } else { "s" };
ws.gctx()
.shell()
.status("Locking", format!("{num_pkgs} package{plural}"))?;
Ok(())
}
fn is_latest(candidate: &semver::Version, current: &semver::Version) -> bool {
current < candidate
// Only match pre-release if major.minor.patch are the same