mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-17 22:07:47 +00:00
Avoid downgrading packages when --upgrade
is provided (#10097)
## Summary When `--upgrade` is provided, we should retain already-installed packages _if_ they're newer than whatever is available from the registry. Closes https://github.com/astral-sh/uv/issues/10089.
This commit is contained in:
parent
eaaf8896ed
commit
0d57d298e6
6 changed files with 180 additions and 62 deletions
|
@ -47,6 +47,15 @@ impl Reinstall {
|
|||
matches!(self, Self::All)
|
||||
}
|
||||
|
||||
/// Returns `true` if the specified package should be reinstalled.
|
||||
pub fn contains(&self, package_name: &PackageName) -> bool {
|
||||
match &self {
|
||||
Self::None => false,
|
||||
Self::All => true,
|
||||
Self::Packages(packages) => packages.contains(package_name),
|
||||
}
|
||||
}
|
||||
|
||||
/// Combine a set of [`Reinstall`] values.
|
||||
#[must_use]
|
||||
pub fn combine(self, other: Self) -> Self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue