Skip to content

Commit 101d0e2

Browse files
authored
Allow --check and --locked to be used together in uv lock (#16538)
See #16517 (comment)
1 parent 1e2ec4a commit 101d0e2

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

crates/uv-cli/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3753,7 +3753,7 @@ pub struct LockArgs {
37533753
/// missing or needs to be updated, uv will exit with an error.
37543754
///
37553755
/// Equivalent to `--locked`.
3756-
#[arg(long, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with_all = ["check_exists", "upgrade", "locked"])]
3756+
#[arg(long, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with_all = ["check_exists", "upgrade"], overrides_with = "check")]
37573757
pub check: bool,
37583758

37593759
/// Check if the lockfile is up-to-date.
@@ -3762,7 +3762,7 @@ pub struct LockArgs {
37623762
/// missing or needs to be updated, uv will exit with an error.
37633763
///
37643764
/// Equivalent to `--check`.
3765-
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with_all = ["check_exists", "upgrade", "check"], hide = true)]
3765+
#[arg(long, env = EnvVars::UV_LOCKED, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with_all = ["check_exists", "upgrade"], hide = true)]
37663766
pub locked: bool,
37673767

37683768
/// Assert that a `uv.lock` exists without checking if it is up-to-date.

crates/uv/tests/it/lock.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13392,6 +13392,19 @@ fn check_outdated_lock() -> Result<()> {
1339213392
Resolved 2 packages in [TIME]
1339313393
The lockfile at `uv.lock` needs to be updated, but `--check` was provided. To update the lockfile, run `uv lock`.
1339413394
");
13395+
13396+
// Providing both `--check` and `--locked` is okay
13397+
uv_snapshot!(context.filters(), context.lock()
13398+
.arg("--check").arg("--locked"), @r"
13399+
success: false
13400+
exit_code: 1
13401+
----- stdout -----
13402+
13403+
----- stderr -----
13404+
Resolved 2 packages in [TIME]
13405+
The lockfile at `uv.lock` needs to be updated, but `--check` was provided. To update the lockfile, run `uv lock`.
13406+
");
13407+
1339513408
Ok(())
1339613409
}
1339713410

0 commit comments

Comments
 (0)