mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Use relative paths for user display (#2559)
## Summary This PR changes our user-facing representation for paths to use relative paths, when the path is within the current working directory. This mirrors what we do in Ruff. (If the path is _outside_ the current working directory, we print an absolute path.) Before: ```shell ❯ uv venv .venv2 Using Python 3.12.2 interpreter at: /Users/crmarsh/workspace/uv/.venv/bin/python3 Creating virtualenv at: .venv2 Activate with: source .venv2/bin/activate ``` After: ```shell ❯ cargo run venv .venv2 Finished dev [unoptimized + debuginfo] target(s) in 0.15s Running `target/debug/uv venv .venv2` Using Python 3.12.2 interpreter at: .venv/bin/python3 Creating virtualenv at: .venv2 Activate with: source .venv2/bin/activate ``` Note that we still want to use the existing `.simplified_display()` anywhere that the path is being simplified, but _still_ intended for machine consumption (e.g., when passing to `.current_dir()`).
This commit is contained in:
parent
204b159cf4
commit
00fc44012c
30 changed files with 149 additions and 183 deletions
|
@ -170,7 +170,7 @@ impl GitRemote {
|
|||
let reference = locked_ref.as_ref().unwrap_or(reference);
|
||||
if let Some(mut db) = db {
|
||||
fetch(&mut db.repo, self.url.as_str(), reference, strategy, client)
|
||||
.with_context(|| format!("failed to fetch into: {}", into.simplified_display()))?;
|
||||
.with_context(|| format!("failed to fetch into: {}", into.user_display()))?;
|
||||
|
||||
let resolved_commit_hash = match locked_rev {
|
||||
Some(rev) => db.contains(rev).then_some(rev),
|
||||
|
@ -190,7 +190,7 @@ impl GitRemote {
|
|||
paths::create_dir_all(into)?;
|
||||
let mut repo = init(into, true)?;
|
||||
fetch(&mut repo, self.url.as_str(), reference, strategy, client)
|
||||
.with_context(|| format!("failed to clone into: {}", into.simplified_display()))?;
|
||||
.with_context(|| format!("failed to clone into: {}", into.user_display()))?;
|
||||
let rev = match locked_rev {
|
||||
Some(rev) => rev,
|
||||
None => reference.resolve(&repo)?,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue