Commit Graph
1355 Commits
Author SHA1 Message Date
Slack Coder 8e58ba6433 cli: Implement DDiff
Define types to support Diff of Diffs leaning on the Radicle Surf types.

Use Radicle Surf's Hunk type, but custom Diff, FileDiff, and
Modification types, and avoid Serde serialization as it does not yet
seem necessary.
2023-09-19 15:22:42 +02:00
Slack Coder cb78f144be cli: Add diff parsing
Parse Git's unified diff format into Radicle Surf's types.  Support to
and from the format helps testing and debugging.

Split the UnifiedDiff trait into Decode and Encode traits so we
can offer Decode in cases where no data could be expected..
For example Option<Hunk<_>> and Hunk<_> allowing partial and repeated
decoding on a byte stream.

Avoid decoding `Diff`, `DiffContent::Binary`, `FileDiff`, and `FileHeader`
types.  `Diff` keeps fields and methods private which are necessary for
decoding.
2023-09-19 15:18:50 +02:00
Slack Coder b337e1b1cb cli: Define UnifiedDiff on concrete type
Simplify the trait by defining it on the concrete type, which appears to
be the standard rust approach.  Remove some oddities in the process (refs
of refs).
2023-09-19 14:46:18 +02:00
cloudhead 5078396028 cli: Move commenting to patch/issue commands
Instead of having `rad comment`, move the command to the respect COBs,
ie. `rad issue comment` and `rad patch comment`.
2023-09-19 14:33:40 +02:00
cloudhead fe5d473af7 cli: Print the identity parent in cob show
The parent that points to the identity document commit was missing
from the output.
2023-09-19 14:22:45 +02:00
cloudhead 8cae60371c cli: Simplified issue opening
We remove the YAML front-matter, since that was annoying to use.
Issues are now edited like patches and commit messages.

Labeling and assigning are done via dedicated commands.
2023-09-19 14:22:45 +02:00
cloudhead 2c4e93b3d2 cli: Show issue comments
When `rad issue show` is run, the issue comments are shown by default.
This can be tweaked using the `--format` option. A value of "header"
only shows the header, while the default which is "full", shows the
header and comments.
2023-09-19 14:22:45 +02:00
Sebastian Martinez 9df1922f15 httpd: Add routes for handling embeds in issues
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-09-19 10:00:01 +02:00
Sebastian Martinez a3f460e67d httpd: Add node alias to session endpoints
This will allow us to show the alias of an authenticated user in the web
client.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-09-18 11:18:17 +02:00
Alexis Sellier 1abce45d5d node: Slightly increase rate limit defaults 2023-09-18 11:14:19 +02:00
Alexis Sellier a7cd7b25f5 node: Allow rate-limitting to be configurable 2023-09-18 11:14:19 +02:00
Alexis Sellier af724eeb0d cli: Add node config command
Shows the current (loaded) node configuration.
2023-09-18 11:14:19 +02:00
Sebastian Martinez 6bb0dd1a28 Update radicle-surf to v0.15.0
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-09-18 10:57:37 +02:00
cloudhead 457b82f723 cob: Evaluate COB state eagerly
Instead of returning histories from `radicle-cob`, we return an
evaluated object which we build during initial graph traversal.

We do this so that branches can be correctly pruned when operations are
invalid at the application level. This way, new operations are not
building on top of invalid ones contained in the history.

To achieve this, we introduce a new `Evaluate` trait that is implemented
by all COBs, and we make change graph evaluation fallible.

Doing this means that we get `apply` errors returned for free when an
invalid transaction is applied, and no longer need to check for action
validity in multiple places.

We also implement a new `Dag::prune` method to avoid having to copy
graph nodes during traversal.
2023-09-11 23:25:28 +02:00
cloudhead 65fa3cbb1b radicle: Make DraftStore generic over the repo
This will allow using it inside of COBs.
2023-09-10 20:44:38 +02:00
cloudhead 6695074479 cob: Don't require full Entry for update
Instead of taking the full entry type, we only need the id.
2023-09-10 20:44:38 +02:00
cloudheadandArastoo Bozorgi c903a958e7 cob: Implement action authorization
Add `authorization` functions to `Patch` and `Issue` COBs.

Co-authored-by: Arastoo Bozorgi <ab1502@mun.ca>
2023-09-09 18:31:52 +02:00
cloudhead f760b1153f dag: Accept multiple roots in fold, remove depth
This allows the fold to start anywhere in our DAG.
2023-09-07 11:48:21 +02:00
cloudhead 5c256c8bfb cob: Remove support for legacy issues 2023-09-07 11:48:18 +02:00
cloudhead 5fc6d96076 cob: Move action handling into its own function
This change is in preparation for further changes where action handling
is called from multiple places.
2023-09-06 20:40:15 +02:00
Fintan Halpenny bf8cee2446 cob: Remove EntryId and RevisionId conversions
Clippy warns that EntryId::from and RevisionId::from are not
required.

Remove the unecessary calls in radicle-cob and radicle.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-09-06 20:07:36 +02:00
cloudhead 287a920d12 cli: Add rad patch set command
Sets the current branch's upstream to point to the given patch.
This allows for pushes to update the patch.

When opening a patch, if the current branch already has an upstream,
it isn't updated automatically. This is why this command exists.
2023-09-06 20:03:58 +02:00
Alexis Sellier 579ddfe725 cli: Give passphrase error on prompt
Example:

    ✗ Invalid passphrase, please try again
    ? Passphrase: ***
2023-09-06 20:03:58 +02:00
Alexis Sellier 5040f33025 cli: Be less confusing when asking for passphrase
The previous error didn't really make sense.
2023-09-06 20:03:58 +02:00
Alexis Sellier 30f2e2260a remote-helper: Ignore decoding errors on fetch
Legacy patches will fail to decode and break the fetch code due to this.
2023-09-06 20:03:58 +02:00
Arastoo Bozorgi 5466232dd4 cob: Work on missing functionality in patches
* Add resolve/unresolve functionalities to threads' comments
* Enable reactions on a revision and code locations
2023-09-06 10:56:14 +02:00
cloudhead 54cc92cc83 cob: Add missing verdict field to review.edit
This is generally useful, and required when constructing a review
without knowing the verdict ahead of time.
2023-09-05 11:17:59 +02:00
cloudhead 152be65053 cob: Wrap patch ID types with new types
To prevent using eg. a `RevisionId` when a `ReviewId` is required,
use compiler types.
2023-09-05 11:17:59 +02:00
cloudhead 16d49c0b82 cli: Don't panic if operation is interrupted
We handle the errors correctly and return.
2023-09-05 11:16:09 +02:00
cloudhead 1ab1da1ba1 cli: Make sure we sync inventory before announcing 2023-09-05 11:16:09 +02:00
cloudhead 112c940d81 cli: Add tests for rad publish 2023-09-05 11:16:09 +02:00
cloudhead 45a2c05a9e cli: Explain how to publish a repo on rad init 2023-09-05 11:16:09 +02:00
cloudhead 1acbe39340 cli: Adjust output of rad sync slightly 2023-09-05 11:16:09 +02:00
cloudhead 9de10ade5a cli: Add --inventory mode to rad sync
This mode allows to announce our inventory. It's not normally needed,
but may be suggested by the `rad publish` command in certain cases.
2023-09-05 11:16:09 +02:00
cloudhead 8199f1a679 cli: Add rad publish command
This command publishes a private repo.
2023-09-05 11:16:05 +02:00
cloudhead 56d6e24ae6 cli: Update rad inspect command
Rename `--id` flag to `--rid`. Update code to match.
2023-09-03 17:21:39 +02:00
cloudhead ba5ed58997 cli: Show repo visibility in rad ls 2023-09-03 17:21:39 +02:00
cloudhead befc76e030 cli: Move init errors up so it fails sooner 2023-09-03 17:21:39 +02:00
cloudhead f2e74fdad2 cli: Choose repo visibility on init
This allows a user to choose private or public visibility on `rad init`.
It also improves the output to tell the user what happened due to this
choice.
2023-09-03 17:21:37 +02:00
Sebastian Martinez d6d280d450 httpd: Return entire files in diff endpoint
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-09-02 19:02:25 +02:00
cloudhead 8ea9921765 httpd: Better error output from git backend 2023-09-01 15:17:41 +02:00
cloudhead 4fb5f6c172 cli: Simplify fatal error output
It didn't make sense to get eg. `Patch failed` when listing patches
failed. We change all fatal errors to simply "Error:", giving more
control over the individual commands.
2023-09-01 15:17:41 +02:00
cloudhead 27e2f47280 term: Fallback to common editors
When `EDITOR` or `VISUAL` are not set, we fallback to the most common
editors. It turns out many users don't have these variables set.

We also check if an editor has been configured with `git`.
2023-09-01 15:17:41 +02:00
cloudhead 3f592e23d4 httpd: Try lowercase READMEs as well 2023-09-01 15:17:41 +02:00
cloudhead 8d5299fe85 cli: rad patch --help opens man page
This is the same behavior as `git`. We also update the man page to have
the full list of commands and flags.
2023-09-01 15:17:41 +02:00
cloudhead b1213931de cli: Add some hints during interactive rad init 2023-09-01 15:17:41 +02:00
cloudhead 46b0dfb11c cli: Improve rad init error when not in Git repo 2023-09-01 15:17:41 +02:00
cloudhead a84555955d cli: Add PID to node start message
We also use a spinner in case it takes longer.
2023-09-01 15:17:41 +02:00
cloudhead 0123433f81 httpd: Fix clippy warning
Note: because we don't have a working copy here, we can't call
`Merged::cleanup`. We need to figure something out for this.
2023-09-01 15:16:56 +02:00
cloudhead bfc3c7164f tools: Add rad-merge tool
It happened that a small bug in the remote helper caused a patch not to
merge correctly on push. Hence, I implemented a `rad-merge` tool for
these cases where we need to fix broken state.
2023-09-01 14:33:23 +02:00