Make --reinstall imply --refresh (#5425)

## Summary

It's hard for me to imagine a scenario in which a user passed
`--reinstall`, but wanted us to keep respecting cached data for a
package. For example, to actually "rebuild and reinstall" an editable
today, you have to pass both `--reinstall` and `--refresh`.

This PR makes `--reinstall` imply `--refresh`, so we always validate
that the cached data is fresh.

Closes https://github.com/astral-sh/uv/issues/5424.
This commit is contained in:
Charlie Marsh
2024-07-25 09:45:58 -04:00
committed by GitHub
parent 4d9098a1d7
commit d0919329fd
10 changed files with 114 additions and 23 deletions
+8 -4
View File
@@ -2548,14 +2548,16 @@ pub struct InstallerArgs {
#[command(flatten)]
pub index_args: IndexArgs,
/// Reinstall all packages, regardless of whether they're already installed.
/// Reinstall all packages, regardless of whether they're already installed. Implies
/// `--refresh`.
#[arg(long, alias = "force-reinstall", overrides_with("no_reinstall"))]
pub reinstall: bool,
#[arg(long, overrides_with("reinstall"), hide = true)]
pub no_reinstall: bool,
/// Reinstall a specific package, regardless of whether it's already installed.
/// Reinstall a specific package, regardless of whether it's already installed. Implies
/// `--refresh-package`.
#[arg(long)]
pub reinstall_package: Vec<PackageName>,
@@ -2712,14 +2714,16 @@ pub struct ResolverInstallerArgs {
#[arg(long, short = 'P')]
pub upgrade_package: Vec<Requirement<VerbatimParsedUrl>>,
/// Reinstall all packages, regardless of whether they're already installed.
/// Reinstall all packages, regardless of whether they're already installed. Implies
/// `--refresh`.
#[arg(long, alias = "force-reinstall", overrides_with("no_reinstall"))]
pub reinstall: bool,
#[arg(long, overrides_with("reinstall"), hide = true)]
pub no_reinstall: bool,
/// Reinstall a specific package, regardless of whether it's already installed.
/// Reinstall a specific package, regardless of whether it's already installed. Implies
/// `--refresh-package`.
#[arg(long)]
pub reinstall_package: Vec<PackageName>,