Commit Graph

2674 Commits

Author SHA1 Message Date
Fintan Halpenny 5053a1aa77 cli/unseed: rename options to args
Have consistent naming for args
2025-11-01 10:52:13 +01:00
Fintan Halpenny 6ca1292350 cli/unfollow: rename options to args
Have consistent naming for args
2025-11-01 10:52:13 +01:00
Fintan Halpenny 3c89525003 cli/sync: migrate to clap
Due to the idiosyncracies of this command there are a few things to note about
this migration.

The `rad sync` command acts as a default subcommand in itself, in that it has
options that do not apply to its subcommand, `rad sync status`. This means that
the options will print with `rad sync --help`, but they will not print with `rad
sync status`.

The `--inventory` flag is not compatible with any of the other flags and
options, thus they are all marked with `conflicts_with`. This cannot be done for
a positional argument, so `clap` will "helpfully" print out the usage, for
example, as:

    error: the argument '--inventory' cannot be used with '--fetch'

    Usage: rad sync --inventory [RID]

    For more information, try '--help'.

Which is incorrect, since `RID` is ignored. This is explained in the `--help`
documentation for `--inventory`.

Co-authored-by: Lorenz Leutgeb <lorenz.leutgeb@radicle.xyz>
2025-11-01 10:52:13 +01:00
Matthias Beyer d1e19a87b0 cli/patch: migrate patch CLI parsing to clap
Co-authored-by: Fintan Halpenny <fintan.halpenny@gmail.com>
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2025-10-29 09:11:05 +00:00
Fintan Halpenny 3ea61f0f98 cli/patch: move comment actions
Moving the sub-comment actions to be beside the top level comment action. This
is mostly to provide a better diff for the next commit – that refactors due to
`clap` changes.
2025-10-29 09:11:05 +00:00
Lorenz Leutgeb e404f1038f node: Use `std::time` for reactor and wire
This reduces the exposure to the `localtime` crate, using
`std` instead.
2025-10-29 09:05:52 +00:00
Sebastian Martinez 9bcdd353c9 cli/inbox: Use clap 2025-10-28 12:11:37 +00:00
Johannes Kühlewindt 5741bafa3b radicle/cob/db: Add index for issues and patches
To improve query performance for issues and patches, add a composite
index on "repo" and "id" to the SQLite database schema via a
migration.
2025-10-25 10:22:50 +02:00
Richard Levitte 990e22acff cli/inspect: use Clap
This includes a horrible - but hopefully short-lived - hack to make
`rad .` work.

Co-authored-by: Lorenz Leutgeb <lorenz.leutgeb@radicle.xyz>
2025-10-22 21:14:12 +02:00
Adrian Duke 5ed1b8e579 node: Fix test 'test_concurrent_fetches'
The test 'test_concurrent_fetches' is broken. It asserts over empty
sets nullifying its utility. Correct the test by changing it so that
sets to be asserted against are cloned.
2025-10-22 17:11:23 +02:00
Erik Kundt e8f9d21be3 cli/node: Use clap
Co-authored-by: Fintan Halpenny <fintan.halpenny@gmail.com>
Co-authored-by: Lorenz Leutgeb <lorenz.leutgeb@radicle.xyz>
2025-10-22 11:27:23 +01:00
Erik Kundt f20c2f215a node: Re-export `PeerAddrParseError`
In order to build higher-level errors that use `PeerAddrParseError`, it
must be re-exported.
2025-10-22 11:27:23 +01:00
Fintan Halpenny 6cfed884bf cli/remote: migrate to clap 2025-10-21 10:12:33 +01:00
Erik Kundt 93578340d1 Add changelog for Radicle 1.4.0 2025-10-20 15:14:21 +01:00
Sebastian Martinez f8fe296ceb radicle/rad: Fix typo 2025-10-20 15:09:43 +01:00
Sebastian Martinez 8604d3bcc7 cli/config: Use clap 2025-10-20 12:04:31 +01:00
Erik Kundt 8d90699c30 cli/cob: Use clap 2025-10-20 11:21:58 +01:00
Fintan Halpenny 38ca038a0d cli: fix test regression in 27a85987c3
A test failure was caused in commit
27a85987c3, which expected `STRING`
instead of `ALIAS`.

This change fixes that discrepancy.
2025-10-17 16:57:29 +01:00
Sebastian Martinez c1d9f04963 cli/self: Use clap 2025-10-17 16:45:20 +01:00
Erik Kundt 27a85987c3 cli: Fix argument value names in `auth` and `init`
We decided to use the value names to indicate which type the value
is parsed into (instead of just saying that the value is a `STRING`).

This makes the value names consistent with other commands again.
2025-10-17 13:43:42 +01:00
Lorenz Leutgeb 44efdc02f9
flake: Fix source filtering
The more complicated filter for `*.txt` did not work. Filtering by
extension directly is not as precise, but there are not many `*.txt`
files in this repository anyway, so the difference should be
neglegible.
2025-10-17 13:00:30 +02:00
Lorenz Leutgeb b3f23594db
git: Ignore parent from blame 2025-10-17 13:00:20 +02:00
Lorenz Leutgeb b0beef4391
workspace/rust/clippy: Fix all warnings
Fix clippy warnings following the upgrade of the Rust toolchain to
version 1.90. Almost all are "mismatched_lifetime_syntaxes".
2025-10-17 12:56:43 +02:00
Lorenz Leutgeb e1b4065353
workspace/rust: 1.88 → 1.90
The update to `flake.lock` is a simple

    nix flake update rust-overlay

to be able to reach 1.90.
2025-10-17 12:56:43 +02:00
Lorenz Leutgeb 0dd2f3f407
workspace/rust/msrv: 1.81 → 1.85
In ed8b086045 the dependency `backtrace`
was introduced which requires Rust 1.82. This dependency should be
kept, so this gives the new lower bound.

As of 2025-10-17, Debian stable ("trixie") has reached 1.85, which is
used as upper bound for the bump.
2025-10-17 12:56:43 +02:00
Erik Kundt 407abc6a2c cli/follow: Use clap 2025-10-17 10:50:21 +01:00
Erik Kundt deaf77e5b4 cli/unfollow: Use common DID / NID argument parser 2025-10-17 10:50:21 +01:00
Erik Kundt e488ddb446 cli: Add common value parser for NID / DID 2025-10-17 10:50:21 +01:00
Richard Levitte 06e22434e1 cli/checkout: use Clap 2025-10-17 08:51:10 +02:00
Erik Kundt 28824a3127 cli/init: Fix argument value names 2025-10-17 08:20:30 +02:00
Erik Kundt 634866889f cli/id: Use clap
This implementation works around the fact that `clap` does currently
not support value parsers for a series of values, so representing
`--payload` as a `Vec<Payload>` does not work.

Instead, we parse eveything into a `Vec<String>` and do the validation
on the application side.

Using value parsers for a series of values will probably be supported in
`clap` v5, though.
2025-10-16 18:14:11 +02:00
Lorenz Leutgeb d3ed4bb497 radicle/id: Introduce `PayloadUpsert`
Instead of using triples, introduce a `struct` to carry upserts.
2025-10-16 18:14:11 +02:00
Erik Kundt ec1d754308 cli/unblock: Use clap 2025-10-16 15:31:47 +01:00
Erik Kundt faf19af9de cli: Share common argument types used in `(un)block`
Since `rad block` and `rad unblock` share the same argument type,
`BlockTarget` is moved to the exising `terminal/args.rs` module.
2025-10-16 15:31:47 +01:00
Fintan Halpenny cef0ff571d oid: use `std:#️⃣:Hasher::hash` over `Hasher::write`
Previously, the `RepoId` was backed by the `git2::Oid` type, which has a `Hash`
implementation that uses `std:#️⃣:Hasher::hash`. This uses a length prefixed
form for hashing.

When switching to `radicle_oid::Oid` and implementing `Hash` without the length
prefix, this subtly changed the hashes going forward.

These hashes are used in `BloomFilter`, which is the type underlying `Filter`.
This resulted in cases where a previous `Filter` that certainly contained
`rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5` were suddenly reporting that they did not
contain this repository.

Changing the implementation of `Hash` for `radicle_oid::Oid` fixes this, and is
confirmed by adding the regression test in `filter.rs`.
2025-10-16 15:14:10 +01:00
Erik Kundt d9ae29deaa cli/seed: Use clap 2025-10-16 13:02:06 +02:00
Erik Kundt 80198d68b6 cli: Share value parser for `Scope` 2025-10-16 13:02:06 +02:00
Fintan Halpenny b7a7f55e78 gix: CVE-2025-31130
Update the `gix` family of crates to avoid the vulnerability reported in
[CVE-2025-31130].

Since `gix-hash` is used in two places, its version definition was moved to the
top-level `Cargo.toml`. `cargo` warned that `default-features` not being defined
in the top-level could result in a future error, so that was carried along with
it. This did not affect the build of `radicle-fetch`.

[CVE-2025-31130]: https://www.cve.org/CVERecord?id=CVE-2025-31130
2025-10-15 11:34:01 +01:00
Lorenz Leutgeb 0b3424857e node/reactor: Correctly handle error events
`fn handle_events` would panic, if there were multiple events for one
token, and the first one that happened to be handled was an error.
Indeed it is concerning if a token is encountered that was never
registered before. However, tokens that were just deregistered must be
tracked.

Using `Vec` here seems a bit costly, in the future,
`smallvec::SmallVec` could be considered.

The "unregister" methods are renamed to "deregister" to better line up
with `mio` vocabulary.

Log statements that helped analysis of the panic that occurred here
are overhauled and improved, requiring a `Debug` bound on types that
obviously implement it.
2025-10-15 10:42:27 +01:00
Lorenz Leutgeb 72cf3d1919 cli/diff: Use clap
The implementation of the *deprecated* command is removed, it now
directly invokes `git diff`.
2025-10-15 10:30:34 +02:00
Lorenz Leutgeb 532e5a0de0 build: Use `git describe` to generate a version
Only if `RADICLE_VERSION` is not set, we ask Git to desribe the commit
we are building. This is better than having all these cases just be
"pre-release", which is not very informative.
2025-10-14 15:34:06 +01:00
Richard Levitte 384c506489 cli/auth: use Clap 2025-10-14 12:55:33 +01:00
Erik Kundt dfd35480be cli/watch: Use clap 2025-10-14 12:49:16 +02:00
Lorenz Leutgeb efe10f95be
workspace: Enable vendored `libgit2`
Multiple crates are enabling this feature. Do that at the workspace
level.
2025-10-13 16:14:23 +02:00
Lorenz Leutgeb b7cfcfff75
workspace: A Little Less `git2`
Make `git2` an *optional* dependency of `radicle-cob`, and refactor
`radicle` to depend on crates that in turn do not depend on `git2`
*non-optionally*

The main offending dependency of `radicle-cob` is `radicle-git-ext`
from the `radicle-git` workspace in repository
(rad:z6cFWeWpnZNHh9rUW8phgA3b5yGt) which *non-optionally* depends on
`git2`.

So, to achieve removal of this dependency:

 1. The crate is refactored to depend on the new crates
    `radicle-git-ref-format` `radicle-git-metadata`, and
    `radicle-oid` introduced in the previous commits, instead of
    `radicle-git-ext`.
 2. Some code from the `radicle-git-ext` crate in the `radicle-git`
    workspace in repository (rad:z6cFWeWpnZNHh9rUW8phgA3b5yGt) is
    copied. See `crates/radicle-cob/src/backend/git/commit.rs`.

This cascades to `radicle` and its dependents.

  Firstly, the there is an
`impl Deref<Target=git2::Oid> for radicle_git_ext::Oid`. This made
it very convenient to just deref to obtain the wrapped `git2::Oid`,
so there are many expressions of the shape `*oid` in `radicle` and
its dependents. However `radicle-oid` does not provide
`impl Deref<Target=git2::Oid> for radicle_oid::Oid`, as notably,
`Target` is an associated type, and not a type parameter, so an
implementation of `Deref` would tie the new `Oid` too tightly to a
particular implementation.
Instead, work with `impl From<radicle_oid::Oid> for git2::Oid`
(which can be enabled using the feature flag `radicle-oid/git2`).
This explains the changes from `*oid` to `oid.into()` at every
transition to "`git2` land".

  Secondly, `radicle` and its dependents are refactored to also depend
on `radicle-git-ref-format` and (much less prominently)
`radicle-git-metadata` instead of `radicle-git-ext`
This is to avoid pulling in `git2` via these dependencies.

  Thirdly, as the re-exports in `crates/radicle/src/git.rs` change,
they are at the same time also cleaned up. Notably, the types from
`radicle-git-ref-format` are re-exported under `fmt` only, not "twice".

While overall this obviously is very much a breaking change, these
changes should mostly amount to changing from `Deref` to `Into`, i.e.,
`*oid` → `oid.into()` and rewriting imports for `radicle::git::fmt`.
This is indicated by the mostly mechanical nature of the changes to
`crates/radicle-{cli,node,remote-helper}`.
2025-10-13 16:14:23 +02:00
Lorenz Leutgeb f4a8908727
git-metadata: New crate extract from `radicle-git`
This is just enough to get heartwood going.

Some code from the `radicle-git-ext` crate in the `radicle-git`
workspace in repository (rad:z6cFWeWpnZNHh9rUW8phgA3b5yGt) is
copied.
2025-10-13 16:07:39 +02:00
Lorenz Leutgeb 793f53b5f0
oid: New crate
For further details on the crate see its documentation in
`crates/radicle-oid/src/lib.rs`.

Changes to `crates/radicle{,-crypto}/Cargo.toml` are to preserve the
default features of their dependencies `serde` and `schemars`,
which are disabled to support `radicle-oid` being `no_std`.
2025-10-13 15:00:12 +02:00
Lorenz Leutgeb 3fcf2a86da
git-ref-format: New crate
For further details on the crate see its documentation in
`crates/radicle-git-ref-format/src/lib.rs`.
2025-10-13 13:34:15 +02:00
Lorenz Leutgeb 292befdb36 radicle: Add `tempfile` to dev-dependencies
In commit 2149770a4b the dependency
`tempfile` was made optional, and added to be enabled by the feature
flag `test`. However, the *tests of this crate itself* need the
dependency *unconditionally* as they want to create temporary
directories.

This was not noticed earlier, since the error does not surface when
the whole workspace is tested (`cargo test --workspace`), but only
when the crate itself is tested (`cargo test --package=radicle`),
because when testing the workspace, dependents of `radicle` will
enable the `test` feature flag.
2025-10-13 12:26:31 +01:00
Lorenz Leutgeb 3e98589a76 github/build: Fix runner names
Apparently `windows-latest-arm` does not exist and we should use
`windows-11-arm`, ditto for `ubuntu-latest-arm` and
`ubuntu-24.04-arm`.
2025-10-13 10:40:51 +01:00