Commit Graph

1239 Commits

Author SHA1 Message Date
Alexis Sellier ff7e9ded17
radicle: Introduce `cob::DraftStore`
This storage backend for COBs stores changes in a `draft/cobs/*` namespace,
which allows for some of the features needed for code review. For
example, users can draft comments and later decide to publish
them.
2023-07-14 16:57:55 +02:00
Alexis Sellier c9162121b0
cob: Parametrize `cob::Store` with repository type
The additional flexibility in choosing a backend for the COB store will
allow things like "draft" COBs that are stored in a different location,
without changing much of the logic.
2023-07-14 16:57:55 +02:00
Alexis Sellier 45ccbde226
Update `radicle-surf` and `git-ref-format` 2023-07-14 16:57:55 +02:00
Fintan Halpenny dfa7ba1df5
radicle: type safe tracking config
The tracking database can be opened in read-only or read-write
mode. Knowing which is being used is significant in concurrent
scenarios, e.g. it's safer to have a read-only handle on multiple
threads.

Provide static type information by signifying what kind of database
handle is being worked with, read or read-write.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-07-14 16:52:42 +02:00
Alexis Sellier 6b6f087c14
Use transaction to insert inventories
Instead of inserting inventory entries one by one, we use a transaction,
which is much faster.
2023-07-14 15:46:46 +02:00
Alexis Sellier b27313bc5c
Don't fail if we can't open the database
We make sure that even if there is no database file, we're still able
to return `None` for the alias lookup.
2023-07-12 11:37:20 +02:00
Alexis Sellier eb701be033
node: Make node aliases required
This is a fairly substantial change, which adds a new configuration file
to the user's `$RAD_HOME` that includes node configuration, including
the alias, and also makes node aliases required.

When running `rad auth`, the user is now prompted for an alias, which
defaults to `$USER`.

When running `rad self`, the alias is now shown.

If the user runs radicle without a config file, the defaults are loaded,
and `$USER` is used as the alias.
2023-07-11 18:08:59 +02:00
Sebastian Martinez 8ed55a1925
cli: Add `--to` flag to `rad issue react`
This allows the CLI to create a reaction to a specific comment without showing the
comment selector.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-07-10 16:41:42 +02:00
xphoniex 329ccbb304
cli: Add alias and check `rad patch` & `rad issue`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-07-10 16:36:15 +02:00
xphoniex 1459e4a57f
cli: Use `.aliases()` store for issues
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-07-10 16:36:15 +02:00
xphoniex 37847d4c63
cli: Use `.aliases()` store for patches
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-07-10 16:36:15 +02:00
xphoniex ff81b1a6ed
node: Use `str::trim_end_matches` for stripping '\0' in alias
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-07-10 16:36:15 +02:00
xphoniex fb63b1c15d
radicle: Improve doc comments
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-07-10 16:36:15 +02:00
Fintan Halpenny bed69ddca9
radicle: fix cyphernet flag & update deps
The `cyphernet` package has two feature flags that delegate to
underlying crates. These are:
* ed25519 = cyphergraphy/ed25519
* p2p-ed25519 = cypheraddr/p2p-ed25519

When attempting to install binaries, the compiler will result in an
error:
```
error[E0432]: unresolved import `cyphernet::addr::PeerAddr`
  --> radicle/src/node.rs:26:9
   |
26 | pub use cyphernet::addr::PeerAddr;
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^ no `PeerAddr` in the root
```

The `PeerAddr` type is only exported when `p2p-ed25519` or
`cypheraddr/p2p-secp256k1` is enabled. The `radicle` crate was using
the `ed25519` flag. Instead, the `p2p-ed25519` flag should be used.

No explanation as to why the previous flag was working could be found,
but is being discussed on Zulip[[0]].

To update the dependencies, a `cargo update` was also excuted to
update the dependencies.

[0]: https://radicle.zulipchat.com/#narrow/stream/369277-heartwood/topic/cyphernet.20dubious.20feature.20flag

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-07-04 11:10:07 +01:00
Alexis Sellier 1a1e63d998
node: Implement `sessions` command
Returns session information through the control socket.

We also update `rad node status` to display sessions.
2023-07-04 00:26:31 +02:00
Alexis Sellier f73389fc62
cli: Make `rad node connect` work like `--connect`
It was using a different syntax.
2023-07-04 00:26:31 +02:00
Alexis Sellier d6e8f0c53e
httpd: Implement `EditCodeComment` in route 2023-07-03 12:31:05 +02:00
Alexis Sellier 369fc7637c
cob: Use new `Immutable` lattice for merges
Instead of `Redactable`, which is not needed since we have an `LWWMap`,
we use a new `Immutable` semilattice.
2023-07-03 12:31:05 +02:00
Alexis Sellier 11b32725c8
cob: Implement review code commenting 2023-07-03 12:31:05 +02:00
Alexis Sellier 45e87a63b9
cob: Changes to patch code review CRDT
This patch incorporates several important changes to code review:

* Code review verdict is no longer editable
  * Made reviews redactable instead
* Renamed review top-level comment to "summary"
* Renamed inline comments to "comments"
* Made inline comments addressable by `EntryId`
  * This is to allow for editing
* Removed inline comments from review creation
  * Added a `CodeComment` action instead
* Removed `Semilattice` instance from `Review`
  * Added a `EditReview` action instead to have more control
* Made it valid for revisions to be redacted concurrently with a review/merge

Most of these changes are needed to support proper inline code comments.
2023-07-03 12:31:05 +02:00
Alexis Sellier e4ab523669
cob: Move comment reactions to comment
To simplify the code, we move comment reactions to the comment struct
itself.
2023-07-03 12:31:05 +02:00
Alexis Sellier 8b010c27a2
cob: Improvements to COB logic
There were a few subtle issues with the apply logic of certain COBs
that should be fixed now.

Note that the underlying store guarantees exactly-once delivery, and so
it does not make sense to test idempotence at the patch level.
2023-07-03 12:31:05 +02:00
Alexis Sellier 0f3212a1b2
cli: `rad self` improvements
* Add `--home` flag
* Organize the information better

Now looks like this:

    DID             did🔑z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
    └╴Node ID (NID) z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
    SSH             running (823)
    ├╴Key (hash)    SHA256:UIedaL6Cxm6OUErh9GQUzzglSk7VpQlVTI1TAFB/HWA
    └╴Key (full)    ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHahWSBEpuT1ESZbynOmBNkLBSnR32Ar4woZqSV2YNH1
    Home            [..]
    ├╴Storage       [..]/storage
    ├╴Keys          [..]/keys
    └╴Node          [..]/node
2023-06-30 14:41:00 +02:00
Alexis Sellier 613e3e5269
cli: Show logs after `rad node start`
When the node is started, we show the first few log lines.
2023-06-29 18:45:16 +02:00
Alexis Sellier 2e6c9827a9
cli: Show logs in `rad node status` 2023-06-29 18:01:49 +02:00
Alexis Sellier e32e28f8b4
cli: Implement `rad node stop` 2023-06-29 17:58:07 +02:00
Alexis Sellier 0d0d354d55
cli: Ask for passphrase upfront in `node start` 2023-06-29 15:02:08 +02:00
Alexis Sellier ba9c5997b7
cli: Add `rad node logs` sub-command
Prints the last `n` lines and follows the log.
2023-06-29 14:58:11 +02:00
Alexis Sellier e33661738c
Move unit files to `systemd` directory 2023-06-22 12:13:30 +02:00
Alexis Sellier 33870572d4
Improve unit files, add binary install to README
After going through the process of getting this working using the unit
files, I found a few issues that are fixed here.
2023-06-22 12:13:30 +02:00
Alexis Sellier 63ff4717dc
cli: Implement hunk-based code review
Review code with an interface similar to `git add -p`.
2023-06-22 11:15:42 +02:00
Alexis Sellier 22360f8c25
radicle: Change review data in patch COB
* `CodeLocation` had a `blob` and `commit` field. These are redundant,
  since the review lives under a revision.
  We also change the line range to be diff-compatible, with an old and
  new range. The ranges are optional to account for different scenarios
  like file deletion, move etc.
* `CodeComment` had redundant getters which were removed in favor of
  public fields. We also remove the `timestamp` field, as it will be
  the same as the review timestamp.
2023-06-22 11:15:42 +02:00
Alexis Sellier d4e073fe4e
cli-test: Add easy file creation syntax
Eg. the following will create `FILE.txt`:

``` ./FILE.txt
Some content...
```
2023-06-22 11:15:42 +02:00
Alexis Sellier e700608095
Update `radicle-surf` 2023-06-22 11:15:42 +02:00
Alexis Sellier e325fa8621
cli: Turn `patch update` into a plumbing command
Remove most of the user-friendly functionality and simplify this command
so that it is only used for scripting.

`git push rad` is now the proper way of updating patches.
2023-06-21 17:02:00 +02:00
Alexis Sellier b25c2e452b
cli: Setup tracking branch on `rad patch checkout`
Just like when opening a new patch, we setup a tracking branch on patch
checkout, so that patches can be updated via a push.
2023-06-21 17:01:56 +02:00
Alexis Sellier 1e948485be
cli: Make some UX improvements to `rad auth`
Better errors, messaging etc.
2023-06-20 16:05:35 +02:00
Alexis Sellier 074b0e55c1
cli: Add user alias to `rad auth`
We were outputting `(me)` previously.
2023-06-20 15:45:14 +02:00
Adam Szkoda 8c701dc908
ci: Move shell scripts into standalone files 2023-06-20 13:16:57 +02:00
Alexis Sellier 9418a20cae
term: Ensure `Editor` gets a TTY
Some text editors don't work correctly if `stdin` is not a TTY device.
2023-06-20 12:18:23 +02:00
Alexis Sellier bb099faa4f
node: Give useful thread names
For the purposes of debugging running nodes, it's useful to know which
threads are doing what. This allows tools like `htop` to reveal which
threads are running.
2023-06-20 11:18:14 +02:00
Alexis Sellier 765823c686
node: Add timeouts to daemon connection 2023-06-16 09:42:34 +02:00
Alexis Sellier cb576cf8c3
cli: Allow setting a different patch base on push
Using `-o patch.base=<oid>`, users can specify a different patch base,
when creating or updating a patch.
2023-06-15 10:25:32 +02:00
Alexis Sellier a6782ac2d6
cli: Add `-v` flag to `rad patch show`
With this flag, additional data such as the patch base is shown.
2023-06-13 13:17:07 +02:00
Alexis Sellier 48f44f4af5
cli: Fix ahead/behind and diff behavior
In certain cases, eg. after a rebase, or when patches are stacked, the
"ahead/behind" and/or the diff stats can be wrong.

This fixes it.
2023-06-13 13:16:00 +02:00
Alexis Sellier ec064891cd
cli: Setup tracking branch on `rad remote add` 2023-06-13 11:09:42 +02:00
Alexis Sellier e9ef0f4aa4
cli: Consolidate working copy remote setup
We consolidate the setup done by `rad checkout`, `rad clone` and `rad
remote add`, so that they all check for node aliases, and are all
capable of setting up tracking branches etc.
2023-06-13 11:09:42 +02:00
Alexis Sellier 5502676aa7
Fixes and improvements to alias handling
* Return the correct alias from a node announcement, stripping '\0'
  bytes.
* Accept `AliasStore` types as references and as owned.
* Store a `null` in the database if the alias received is empty.
2023-06-13 11:09:42 +02:00
Alexis Sellier 50a97d9add
cli: Add `--scope` flag to `rad init`
Defaults to `all`.
2023-06-13 11:09:42 +02:00
Alexis Sellier 06566dac6f
cli: Add `--scope` flag for `rad clone`
This allows for a scope to be specified when cloning.

We also change the default scope when cloning to 'all' to more closely
match user expectations.
2023-06-13 11:09:42 +02:00