Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions crates/uv-configuration/src/package_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,15 @@ impl Upgrade {
/// Combine a set of [`Upgrade`] values.
#[must_use]
pub fn combine(self, other: Self) -> Self {
// For `strategy`: `other` takes precedence for an explicit `All` or `None`; otherwise,
// For `strategy`: an explicit `All` or `None` in `self` takes precedence; otherwise,
// merge.
let strategy = match (self.strategy, other.strategy) {
(_, UpgradeStrategy::All) => UpgradeStrategy::All,
(_, UpgradeStrategy::None) => UpgradeStrategy::None,
(UpgradeStrategy::All, _) => UpgradeStrategy::All,
(UpgradeStrategy::None, _) => UpgradeStrategy::None,
(UpgradeStrategy::Some(_, _), UpgradeStrategy::All) => UpgradeStrategy::All,
(UpgradeStrategy::Some(packages, groups), UpgradeStrategy::None) => {
UpgradeStrategy::Some(packages, groups)
}
(
UpgradeStrategy::Some(mut self_packages, mut self_groups),
UpgradeStrategy::Some(other_packages, other_groups),
Expand All @@ -268,7 +272,6 @@ impl Upgrade {
self_groups.extend(other_groups);
UpgradeStrategy::Some(self_packages, self_groups)
}
(_, UpgradeStrategy::Some(packages, groups)) => UpgradeStrategy::Some(packages, groups),
};

// For `constraints`: always merge the constraints of `self` and `other`.
Expand Down
126 changes: 70 additions & 56 deletions crates/uv/tests/sync/show_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4055,21 +4055,14 @@ fn upgrade_pip_cli_config_interaction() -> anyhow::Result<()> {
.arg("requirements.in"),
@r#"
...
Verify,
),
upgrade: Upgrade {
- strategy: Some(
- {
- PackageName(
strategy: Some(
{
PackageName(
- "sniffio",
- ),
- },
- {},
- ),
+ strategy: None,
constraints: {},
},
reinstall: None,
+ "idna",
),
},
{},
...
"#
);
Expand Down Expand Up @@ -4121,14 +4114,21 @@ fn upgrade_pip_cli_config_interaction() -> anyhow::Result<()> {
.arg("--show-settings")
.arg("requirements.in"), @r#"
...
strategy: Some(
{
PackageName(
Verify,
),
upgrade: Upgrade {
- strategy: Some(
- {
- PackageName(
- "sniffio",
+ "idna",
),
},
{},
- ),
- },
- {},
- ),
+ strategy: None,
constraints: {},
},
reinstall: None,
...
"#
);
Expand All @@ -4140,14 +4140,21 @@ fn upgrade_pip_cli_config_interaction() -> anyhow::Result<()> {
.arg("--show-settings")
.arg("requirements.in"), @r#"
...
strategy: Some(
{
PackageName(
Verify,
),
upgrade: Upgrade {
- strategy: Some(
- {
- PackageName(
- "sniffio",
+ "idna",
),
},
{},
- ),
- },
- {},
- ),
+ strategy: All,
constraints: {},
},
reinstall: None,
...
"#
);
Expand Down Expand Up @@ -4248,21 +4255,14 @@ fn upgrade_project_cli_config_interaction() -> anyhow::Result<()> {
.arg("--show-settings"),
@r#"
...
cuda_driver_version: None,
amd_gpu_architecture: None,
upgrade: Upgrade {
- strategy: Some(
- {
- PackageName(
strategy: Some(
{
PackageName(
- "sniffio",
- ),
- },
- {},
- ),
+ strategy: None,
constraints: {},
},
},
+ "idna",
),
},
{},
...
"#
);
Expand Down Expand Up @@ -4320,14 +4320,21 @@ fn upgrade_project_cli_config_interaction() -> anyhow::Result<()> {
.arg("--no-upgrade")
.arg("--show-settings"), @r#"
...
strategy: Some(
{
PackageName(
cuda_driver_version: None,
amd_gpu_architecture: None,
upgrade: Upgrade {
- strategy: Some(
- {
- PackageName(
- "sniffio",
+ "idna",
),
},
{},
- ),
- },
- {},
- ),
+ strategy: None,
constraints: {},
},
},
...
"#
);
Expand All @@ -4338,14 +4345,21 @@ fn upgrade_project_cli_config_interaction() -> anyhow::Result<()> {
.arg("--upgrade")
.arg("--show-settings"), @r#"
...
strategy: Some(
{
PackageName(
cuda_driver_version: None,
amd_gpu_architecture: None,
upgrade: Upgrade {
- strategy: Some(
- {
- PackageName(
- "sniffio",
+ "idna",
),
},
{},
- ),
- },
- {},
- ),
+ strategy: All,
constraints: {},
},
},
...
"#
);
Expand Down
Loading