From 36fc031da22c7ccbfc94545747203bc8da9d17c0 Mon Sep 17 00:00:00 2001 From: Lorenz Leutgeb Date: Sun, 11 Jan 2026 15:16:09 +0100 Subject: [PATCH] surf: Switch to crate in workspace Now that `radicle-surf` lives in this workspace, use it. --- Cargo.lock | 146 +----------------- Cargo.toml | 7 +- .../src/commands/patch/review/builder.rs | 33 ++-- crates/radicle-cli/src/git/pretty_diff.rs | 8 +- crates/radicle-cli/src/git/unified_diff.rs | 12 +- 5 files changed, 29 insertions(+), 177 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 122824204..13ee0127b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1089,17 +1089,6 @@ version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" -[[package]] -name = "filetime" -version = "0.2.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98844151eee8917efc50bd9e8318cb963ae8b297431495d3f758616ea5c57db" -dependencies = [ - "cfg-if", - "libc", - "libredox", -] - [[package]] name = "find-msvc-tools" version = "0.1.9" @@ -1217,16 +1206,6 @@ version = "0.32.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" -[[package]] -name = "git-ref-format" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c56b3fd79d4f8678e804bf9e60ef31bc810889d702df1e7280d800b3c907e1af" -dependencies = [ - "git-ref-format-core", - "git-ref-format-macro", -] - [[package]] name = "git-ref-format-core" version = "0.6.0" @@ -1238,18 +1217,6 @@ dependencies = [ "thiserror 1.0.69", ] -[[package]] -name = "git-ref-format-macro" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d38795f40abc04aed7473ce282be6a5da97ae58a1445a014193d3bf302b034cf" -dependencies = [ - "git-ref-format-core", - "proc-macro-error3", - "quote", - "syn 2.0.117", -] - [[package]] name = "git2" version = "0.21.0" @@ -2186,18 +2153,6 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" -[[package]] -name = "libredox" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1744e39d1d6a9948f4f388969627434e31128196de472883b39f148769bfe30a" -dependencies = [ - "bitflags", - "libc", - "plain", - "redox_syscall 0.7.3", -] - [[package]] name = "libz-sys" version = "1.1.25" @@ -2602,7 +2557,7 @@ checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.18", + "redox_syscall", "smallvec", "windows-link 0.2.1", ] @@ -2689,12 +2644,6 @@ version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" -[[package]] -name = "plain" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" - [[package]] name = "poly1305" version = "0.8.0" @@ -2770,28 +2719,6 @@ dependencies = [ "elliptic-curve", ] -[[package]] -name = "proc-macro-error-attr3" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34e4dd828515431dd6c4a030d26f7eaed7dd4778226e9d2bb968d65ca4ec3d4d" -dependencies = [ - "proc-macro2", - "quote", -] - -[[package]] -name = "proc-macro-error3" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee475e440453418ff1335189eddf7101ba502cd818ab7ae04209bc83aa925aa" -dependencies = [ - "proc-macro-error-attr3", - "proc-macro2", - "quote", - "syn 2.0.117", -] - [[package]] name = "proc-macro2" version = "1.0.106" @@ -2939,7 +2866,7 @@ dependencies = [ "radicle-localtime", "radicle-log", "radicle-node", - "radicle-surf 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", + "radicle-surf", "radicle-term", "schemars", "serde", @@ -3067,20 +2994,6 @@ dependencies = [ "thiserror 2.0.18", ] -[[package]] -name = "radicle-git-ext" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a30b3153c4db6898f21ad8b0d7f2d6fe04434ec9b66764ef34e23b0b05167ba" -dependencies = [ - "git-ref-format", - "git2", - "percent-encoding", - "radicle-std-ext", - "serde", - "thiserror 1.0.69", -] - [[package]] name = "radicle-git-metadata" version = "0.2.0" @@ -3218,12 +3131,6 @@ dependencies = [ "windows 0.62.2", ] -[[package]] -name = "radicle-std-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb935931bdd2a2966f3b584f3031d9d54ec0713ddbc563a0193d54e62a88ec73" - [[package]] name = "radicle-surf" version = "0.28.0" @@ -3246,25 +3153,6 @@ dependencies = [ "url", ] -[[package]] -name = "radicle-surf" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee7a801291a59d24a533fa4923721181e2ca1d588c8418cdbf619a81b726d273" -dependencies = [ - "anyhow", - "base64 0.21.7", - "flate2", - "git2", - "log", - "nonempty 0.9.0", - "radicle-git-ext", - "radicle-std-ext", - "tar", - "thiserror 1.0.69", - "url", -] - [[package]] name = "radicle-systemd" version = "0.13.0" @@ -3378,15 +3266,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "redox_syscall" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce70a74e890531977d37e532c34d45e9055d2409ed08ddba14529471ed0be16" -dependencies = [ - "bitflags", -] - [[package]] name = "ref-cast" version = "1.0.25" @@ -4211,17 +4090,6 @@ dependencies = [ "rustix", ] -[[package]] -name = "tar" -version = "0.4.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22692a6476a21fa75fdfc11d452fda482af402c008cdbaf3476414e122040973" -dependencies = [ - "filetime", - "libc", - "xattr", -] - [[package]] name = "tempfile" version = "3.27.0" @@ -5274,16 +5142,6 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" -[[package]] -name = "xattr" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156" -dependencies = [ - "libc", - "rustix", -] - [[package]] name = "yansi" version = "1.0.1" diff --git a/Cargo.toml b/Cargo.toml index 3c25da833..9053ca589 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,6 +58,7 @@ radicle-node = { version = "0.21", path = "crates/radicle-node" } radicle-oid = { version = "0.2.1", path = "crates/radicle-oid", default-features = false } radicle-protocol = { version = "0.9", path = "crates/radicle-protocol" } radicle-signals = { version = "0.12", path = "crates/radicle-signals" } +radicle-surf = { version = "0.28.0", path = "crates/radicle-surf", default-features = false } radicle-systemd = { version = "0.13", path = "crates/radicle-systemd" } radicle-term = { version = "0.19", path = "crates/radicle-term" } radicle-windows = { version = "0.1", path = "crates/radicle-windows" } @@ -75,12 +76,8 @@ winpipe = "0.1.1" winsplit = "0.1.0" zeroize = { version = "1.5.7", default-features = false } -# Crates from the "radicle-git" workspace. These should be synced manually. -# When updating, start from `radicle-surf`: -# `radicle-surf` → `radicle-git-ext` → `git-ref-format` → `git-ref-format-core` -# Also note that `radicle-surf → git2` so try to also sync with `git2`. +# Crates from the "radicle-git" workspace. git-ref-format-core = { version = "0.6.0", default-features = false } -radicle-surf = "0.28.0" [workspace.lints.clippy] fallible_impl_from = "deny" diff --git a/crates/radicle-cli/src/commands/patch/review/builder.rs b/crates/radicle-cli/src/commands/patch/review/builder.rs index 09f7e4150..4b48d2668 100644 --- a/crates/radicle-cli/src/commands/patch/review/builder.rs +++ b/crates/radicle-cli/src/commands/patch/review/builder.rs @@ -200,28 +200,25 @@ impl ReviewItem { #[allow(clippy::type_complexity)] fn paths(&self) -> (Option<(&Path, Oid)>, Option<(&Path, Oid)>) { match self { - Self::FileAdded { path, new, .. } => (None, Some((path, Oid::from(*new.oid)))), - Self::FileDeleted { path, old, .. } => (Some((path, Oid::from(*old.oid))), None), + Self::FileAdded { path, new, .. } => (None, Some((path, new.oid))), + Self::FileDeleted { path, old, .. } => (Some((path, old.oid)), None), Self::FileMoved { moved } => ( - Some((&moved.old_path, Oid::from(*moved.old.oid))), - Some((&moved.new_path, Oid::from(*moved.new.oid))), + Some((&moved.old_path, moved.old.oid)), + Some((&moved.new_path, moved.new.oid)), ), Self::FileCopied { copied } => ( - Some((&copied.old_path, Oid::from(*copied.old.oid))), - Some((&copied.new_path, Oid::from(*copied.new.oid))), - ), - Self::FileModified { path, old, new, .. } => ( - Some((path, Oid::from(*old.oid))), - Some((path, Oid::from(*new.oid))), - ), - Self::FileEofChanged { path, old, new, .. } => ( - Some((path, Oid::from(*old.oid))), - Some((path, Oid::from(*new.oid))), - ), - Self::FileModeChanged { path, old, new, .. } => ( - Some((path, Oid::from(*old.oid))), - Some((path, Oid::from(*new.oid))), + Some((&copied.old_path, copied.old.oid)), + Some((&copied.new_path, copied.new.oid)), ), + Self::FileModified { path, old, new, .. } => { + (Some((path, old.oid)), Some((path, new.oid))) + } + Self::FileEofChanged { path, old, new, .. } => { + (Some((path, old.oid)), Some((path, new.oid))) + } + Self::FileModeChanged { path, old, new, .. } => { + (Some((path, old.oid)), Some((path, new.oid))) + } } } diff --git a/crates/radicle-cli/src/git/pretty_diff.rs b/crates/radicle-cli/src/git/pretty_diff.rs index d7eaae92a..53bb7052c 100644 --- a/crates/radicle-cli/src/git/pretty_diff.rs +++ b/crates/radicle-cli/src/git/pretty_diff.rs @@ -338,7 +338,7 @@ impl ToPretty for Added { repo: &R, ) -> Self::Output { let old = None; - let new = Some((self.path.as_path(), Oid::from(*self.new.oid))); + let new = Some((self.path.as_path(), self.new.oid)); pretty_modification(header, &self.diff, old, new, repo, hi) } @@ -354,7 +354,7 @@ impl ToPretty for Deleted { header: &Self::Context, repo: &R, ) -> Self::Output { - let old = Some((self.path.as_path(), Oid::from(*self.old.oid))); + let old = Some((self.path.as_path(), self.old.oid)); let new = None; pretty_modification(header, &self.diff, old, new, repo, hi) @@ -371,8 +371,8 @@ impl ToPretty for Modified { header: &Self::Context, repo: &R, ) -> Self::Output { - let old = Some((self.path.as_path(), Oid::from(*self.old.oid))); - let new = Some((self.path.as_path(), Oid::from(*self.new.oid))); + let old = Some((self.path.as_path(), self.old.oid)); + let new = Some((self.path.as_path(), self.new.oid)); pretty_modification(header, &self.diff, old, new, repo, hi) } diff --git a/crates/radicle-cli/src/git/unified_diff.rs b/crates/radicle-cli/src/git/unified_diff.rs index 3b4fc8f78..24fb8f8df 100644 --- a/crates/radicle-cli/src/git/unified_diff.rs +++ b/crates/radicle-cli/src/git/unified_diff.rs @@ -309,8 +309,8 @@ impl Encode for FileHeader { if old.mode == new.mode { w.meta(format!( "index {}..{} {:o}", - term::format::oid(*old.oid), - term::format::oid(*new.oid), + term::format::oid(old.oid), + term::format::oid(new.oid), u32::from(old.mode.clone()), ))?; } else { @@ -318,8 +318,8 @@ impl Encode for FileHeader { w.meta(format!("new mode {:o}", u32::from(new.mode.clone())))?; w.meta(format!( "index {}..{}", - term::format::oid(*old.oid), - term::format::oid(*new.oid) + term::format::oid(old.oid), + term::format::oid(new.oid) ))?; } @@ -337,7 +337,7 @@ impl Encode for FileHeader { w.meta(format!( "index {}..{}", term::format::oid(git::Oid::ZERO_SHA1), - term::format::oid(*new.oid), + term::format::oid(new.oid), ))?; w.meta("--- /dev/null")?; @@ -357,7 +357,7 @@ impl Encode for FileHeader { ))?; w.meta(format!( "index {}..{}", - term::format::oid(*old.oid), + term::format::oid(old.oid), term::format::oid(git::Oid::ZERO_SHA1) ))?;