mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 13:25:00 +00:00
Rename uv add --raw
to --raw-sources
(#4538)
## Summary This feels a bit clearer and less ambiguous.
This commit is contained in:
parent
d4fd868531
commit
fe13ea39f0
5 changed files with 11 additions and 11 deletions
|
@ -1757,7 +1757,7 @@ pub struct AddArgs {
|
|||
///
|
||||
/// Without this flag uv will try to use `tool.uv.sources` for any sources.
|
||||
#[arg(long)]
|
||||
pub raw: bool,
|
||||
pub raw_sources: bool,
|
||||
|
||||
/// Specific commit to use when adding from Git.
|
||||
#[arg(long)]
|
||||
|
|
|
@ -28,7 +28,7 @@ pub(crate) async fn add(
|
|||
requirements: Vec<RequirementsSource>,
|
||||
dev: bool,
|
||||
editable: Option<bool>,
|
||||
raw: bool,
|
||||
raw_sources: bool,
|
||||
rev: Option<String>,
|
||||
tag: Option<String>,
|
||||
branch: Option<String>,
|
||||
|
@ -148,7 +148,7 @@ pub(crate) async fn add(
|
|||
// Add the requirements to the `pyproject.toml`.
|
||||
let mut pyproject = PyProjectTomlMut::from_toml(project.current_project().pyproject_toml())?;
|
||||
for req in requirements {
|
||||
let (req, source) = if raw {
|
||||
let (req, source) = if raw_sources {
|
||||
// Use the PEP 508 requirement directly.
|
||||
(pep508_rs::Requirement::from(req), None)
|
||||
} else {
|
||||
|
@ -167,7 +167,7 @@ pub(crate) async fn add(
|
|||
let source = match result {
|
||||
Ok(source) => source,
|
||||
Err(SourceError::UnresolvedReference(rev)) => {
|
||||
anyhow::bail!("Cannot resolve Git reference `{rev}` for requirement `{}`. Specify the reference with one of `--tag`, `--branch`, or `--rev`, or use the `--raw` flag.", req.name)
|
||||
anyhow::bail!("Cannot resolve Git reference `{rev}` for requirement `{}`. Specify the reference with one of `--tag`, `--branch`, or `--rev`, or use the `--raw-sources` flag.", req.name)
|
||||
}
|
||||
Err(err) => return Err(err.into()),
|
||||
};
|
||||
|
|
|
@ -721,7 +721,7 @@ async fn run() -> Result<ExitStatus> {
|
|||
args.requirements,
|
||||
args.dev,
|
||||
args.editable,
|
||||
args.raw,
|
||||
args.raw_sources,
|
||||
args.rev,
|
||||
args.tag,
|
||||
args.branch,
|
||||
|
|
|
@ -433,7 +433,7 @@ pub(crate) struct AddSettings {
|
|||
pub(crate) requirements: Vec<RequirementsSource>,
|
||||
pub(crate) dev: bool,
|
||||
pub(crate) editable: Option<bool>,
|
||||
pub(crate) raw: bool,
|
||||
pub(crate) raw_sources: bool,
|
||||
pub(crate) rev: Option<String>,
|
||||
pub(crate) tag: Option<String>,
|
||||
pub(crate) branch: Option<String>,
|
||||
|
@ -451,7 +451,7 @@ impl AddSettings {
|
|||
requirements,
|
||||
dev,
|
||||
editable,
|
||||
raw,
|
||||
raw_sources,
|
||||
rev,
|
||||
tag,
|
||||
branch,
|
||||
|
@ -471,7 +471,7 @@ impl AddSettings {
|
|||
requirements,
|
||||
dev,
|
||||
editable,
|
||||
raw,
|
||||
raw_sources,
|
||||
rev,
|
||||
tag,
|
||||
branch,
|
||||
|
|
|
@ -167,7 +167,7 @@ fn add_git() -> Result<()> {
|
|||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
error: Cannot resolve Git reference `0.0.1` for requirement `uv-public-pypackage`. Specify the reference with one of `--tag`, `--branch`, or `--rev`, or use the `--raw` flag.
|
||||
error: Cannot resolve Git reference `0.0.1` for requirement `uv-public-pypackage`. Specify the reference with one of `--tag`, `--branch`, or `--rev`, or use the `--raw-sources` flag.
|
||||
"###);
|
||||
|
||||
uv_snapshot!(context.filters(), context.add(&["uv-public-pypackage @ git+https://github.com/astral-test/uv-public-pypackage"]).arg("--tag=0.0.1").arg("--preview"), @r###"
|
||||
|
@ -277,7 +277,7 @@ fn add_git() -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Add a Git requirement using the `--raw` API.
|
||||
/// Add a Git requirement using the `--raw-sources` API.
|
||||
#[test]
|
||||
fn add_git_raw() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
|
@ -317,7 +317,7 @@ fn add_git_raw() -> Result<()> {
|
|||
"###);
|
||||
|
||||
// Use an ambiguous tag reference, which would otherwise not resolve.
|
||||
uv_snapshot!(context.filters(), context.add(&["uv-public-pypackage @ git+https://github.com/astral-test/uv-public-pypackage@0.0.1"]).arg("--raw").arg("--preview"), @r###"
|
||||
uv_snapshot!(context.filters(), context.add(&["uv-public-pypackage @ git+https://github.com/astral-test/uv-public-pypackage@0.0.1"]).arg("--raw-sources").arg("--preview"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue