diff --git a/crates/uv/src/main.rs b/crates/uv/src/main.rs index 5eae5b7ac4ae..0fc9466540e0 100644 --- a/crates/uv/src/main.rs +++ b/crates/uv/src/main.rs @@ -8,7 +8,7 @@ use anyhow::Result; use clap::error::{ContextKind, ContextValue}; use clap::{CommandFactory, Parser}; use owo_colors::OwoColorize; -use tracing::instrument; +use tracing::{debug, instrument}; use cli::{ToolCommand, ToolNamespace, ToolchainCommand, ToolchainNamespace}; use uv_cache::Cache; @@ -174,6 +174,8 @@ async fn run() -> Result { ) }))?; + debug!("uv {}", version::version()); + // Resolve the cache settings. let cache = CacheSettings::resolve(cli.cache_args, workspace.as_ref()); let cache = Cache::from_settings(cache.no_cache, cache.cache_dir)?; diff --git a/crates/uv/tests/cache_prune.rs b/crates/uv/tests/cache_prune.rs index 4d96e697995e..ab0b905aae00 100644 --- a/crates/uv/tests/cache_prune.rs +++ b/crates/uv/tests/cache_prune.rs @@ -68,12 +68,19 @@ fn prune_no_op() -> Result<()> { .assert() .success(); - uv_snapshot!(context.filters(), prune_command(&context).arg("--verbose"), @r###" + let filters: Vec<_> = context + .filters() + .into_iter() + .chain([(r"uv \d+\.\d+\.\d+ \(.*\)", r"uv [VERSION] ([COMMIT] DATE)")]) + .collect(); + + uv_snapshot!(filters, prune_command(&context).arg("--verbose"), @r###" success: true exit_code: 0 ----- stdout ----- ----- stderr ----- + DEBUG uv [VERSION] ([COMMIT] DATE) Pruning cache at: [CACHE_DIR]/ No unused entries found "###); @@ -99,12 +106,19 @@ fn prune_stale_directory() -> Result<()> { let simple = context.cache_dir.child("simple-v4"); simple.create_dir_all()?; - uv_snapshot!(context.filters(), prune_command(&context).arg("--verbose"), @r###" + let filters: Vec<_> = context + .filters() + .into_iter() + .chain([(r"uv \d+\.\d+\.\d+ \(.*\)", r"uv [VERSION] ([COMMIT] DATE)")]) + .collect(); + + uv_snapshot!(filters, prune_command(&context).arg("--verbose"), @r###" success: true exit_code: 0 ----- stdout ----- ----- stderr ----- + DEBUG uv [VERSION] ([COMMIT] DATE) Pruning cache at: [CACHE_DIR]/ DEBUG Removing dangling cache entry: [CACHE_DIR]/simple-v4 Removed 1 directory @@ -135,6 +149,7 @@ fn prune_stale_symlink() -> Result<()> { .filters() .into_iter() .chain([ + (r"uv \d+\.\d+\.\d+ \(.*\)", r"uv [VERSION] ([COMMIT] DATE)"), // The cache entry does not have a stable key, so we filter it out ( r"\[CACHE_DIR\](\\|\/)(.+)(\\|\/).*", @@ -149,6 +164,7 @@ fn prune_stale_symlink() -> Result<()> { ----- stdout ----- ----- stderr ----- + DEBUG uv [VERSION] ([COMMIT] DATE) Pruning cache at: [CACHE_DIR]/ DEBUG Removing dangling cache entry: [CACHE_DIR]/archive-v0/[ENTRY] Removed 44 files ([SIZE])