Fix incorrect error message when specifying `tool.uv.sources.(package).workspace` with other options (#11013)

## Summary

When a `pyproject.toml` `[tool.uv.sources.(package)]` section specifies
`workspace` and one or more of (`index`, `git`, `url`, `path`, `rev`,
`tag`, `branch`, `editable`), running `uv` to build or sync the package
gives the error:

```
cannot specify both `index` and `(parameter name)`
```

The error should actually say:

```
cannot specify both `workspace` and `(parameter name)`
```

## Test Plan

I ran `cargo test`, and all tests still passed.
This commit is contained in:
micolous 2025-01-29 00:25:33 +10:00 committed by GitHub
parent a2db48d649
commit 52870c587c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 8 deletions

View File

@ -1242,42 +1242,42 @@ impl<'de> Deserialize<'de> for Source {
if let Some(workspace) = workspace { if let Some(workspace) = workspace {
if index.is_some() { if index.is_some() {
return Err(serde::de::Error::custom( return Err(serde::de::Error::custom(
"cannot specify both `index` and `index`", "cannot specify both `workspace` and `index`",
)); ));
} }
if git.is_some() { if git.is_some() {
return Err(serde::de::Error::custom( return Err(serde::de::Error::custom(
"cannot specify both `index` and `git`", "cannot specify both `workspace` and `git`",
)); ));
} }
if url.is_some() { if url.is_some() {
return Err(serde::de::Error::custom( return Err(serde::de::Error::custom(
"cannot specify both `index` and `url`", "cannot specify both `workspace` and `url`",
)); ));
} }
if path.is_some() { if path.is_some() {
return Err(serde::de::Error::custom( return Err(serde::de::Error::custom(
"cannot specify both `index` and `path`", "cannot specify both `workspace` and `path`",
)); ));
} }
if rev.is_some() { if rev.is_some() {
return Err(serde::de::Error::custom( return Err(serde::de::Error::custom(
"cannot specify both `index` and `rev`", "cannot specify both `workspace` and `rev`",
)); ));
} }
if tag.is_some() { if tag.is_some() {
return Err(serde::de::Error::custom( return Err(serde::de::Error::custom(
"cannot specify both `index` and `tag`", "cannot specify both `workspace` and `tag`",
)); ));
} }
if branch.is_some() { if branch.is_some() {
return Err(serde::de::Error::custom( return Err(serde::de::Error::custom(
"cannot specify both `index` and `branch`", "cannot specify both `workspace` and `branch`",
)); ));
} }
if editable.is_some() { if editable.is_some() {
return Err(serde::de::Error::custom( return Err(serde::de::Error::custom(
"cannot specify both `index` and `editable`", "cannot specify both `workspace` and `editable`",
)); ));
} }