Commit Graph

1018 Commits

Author SHA1 Message Date
Alexis Sellier c1d4e87d25
ci: Use local deploy script instead of CI
Further reduce GitHub reliance.
2023-05-10 10:41:01 +02:00
Vincenzo Palazzo b29321dbf7
cob: Fix recursion bug in TryFrom of Reference
This commit addresses the issue of recursion in the TryFrom
call of Reference by resolving the parent in a lazy way.

Due to constraints posed by the need to access `git2::Repository`
or `git2::Commit` to resolve the parent, this commit decides to
pull out the parent resolution logic from the `cob::object::Commit`
module and move it inside the `cob::store::Store` implementation by adding
a new method `parents_of`.

Suggested-by: Fintan Halpenny <fintan.halpenny@gmail.com>
Tested-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-05-09 10:11:36 +02:00
Alexis Sellier 1d9ee81b6d
node: Rename `reactor` module to `io`
The name was always confusing and didn't mean much in the contetx of the
service.
2023-05-08 19:31:20 +02:00
Fintan Halpenny 8508eab8fa
radicle: update radicle-git-ext
This change updates to the latest radicle-git-ext, which required a
few changes within the radicle family of crates.

One set of changes is that the radicle-git-ext crate subsumes
git-commit, git-trailers, and git-ref-format -- so all those imports
go through radicle-git-ext.

The commit code requires that parent `Oid`s point to commits, which
made some tests fail. One of the reasons for these failures is that
the patch tests used fabricated `Oid`s and so the verification would
fail. This is fixed by allowing the test context code to create
`PatchRequest`s that create valid commits.
The other reason for failure was that the identity `Action` passed an
`Oid` that pointed to a blob. This is fixed by removing that code and
making a note of it in documentation.

The final major change was moving the Refspec type into git-ref-format
and removing the AsRefspecs trait. The trait was not required and
could its usage could be replaced by simpler code.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-08 10:36:15 +01:00
Alexis Sellier 293a76948f
Update `SignedRefs::save` function
* Remove redundant `remote` parameter
* Fix commit message and remove redundant remote
2023-05-08 11:13:55 +02:00
Fintan Halpenny 2ff6bf2fc4
cli: remove the 'rad' remote during `rad rm`
If the 'rad' remote is still in the git config, then some of the CLI
tooling will think the project exists -- even after running `rad rm`.

For example, in the current state, if `rad rm` is followed by `rad
init` then the operation will fail.

During `rad rm`, attempt to delete the 'rad' remote.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-08 10:49:18 +02:00
Fintan Halpenny c49412a73f
cli: allow rad rm to untrack without running node
Previously, `rad rm` would require the node to be running to untrack
the repository.

This is no longer necessary since the tracking db is exposed via the
`radicle` crate. Instead, use the db directly to untrack the RID
during `rad rm`, as long as the node is not already running.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-08 10:49:18 +02:00
Slack Coder 6fe5dfa3c9
cli: Refactor `rad issue open`
Make code clearer by lifting it into its own method.
2023-05-08 10:40:45 +02:00
Slack Coder f4dff17085
cli: Refactor `rad issue list`
Move code into its own method.
2023-05-08 10:40:45 +02:00
Slack Coder e0241050f8
cli: List issues consistent
Help the user by ordering issue listing by their creation time to make
it consistent.
2023-05-08 10:40:45 +02:00
Slack Coder 3e2cf83f9b
cli: List patches by last update
To help users notice changes to patches, make `rad patch` order patches
by revision timestamp instead of patch timestamp.
2023-05-08 10:32:48 +02:00
Slack Coder 091154faed
cli: Make patch listing deterministic
Help the users by making the patch listing consistent.  Order the
patches by their creation time and id.
2023-05-08 10:32:48 +02:00
Alexis Sellier 0349699200
node: Don't connect to recently attempted peers 2023-05-05 17:23:52 +02:00
Alexis Sellier ca0abc4356
node: Keep track of connection attempts
When attempting to connect to a peer, and when succeeding, write the timestamp
to the database.

This will allow us to better select addresses and not retry peers to
soon.
2023-05-05 17:23:52 +02:00
Slack Coder b5a00dfc4c
cli: Clarify user facing patch message
Now logic for parsing and supporting user facing Patch messages is
shared for creation and editing, refactor and move supporting code to
terminal::patch.

This fixes a bug where the title may be incorrectly parsed, resulting in
it containing multiple lines.
2023-05-05 17:22:20 +02:00
Slack Coder 6bedb1256c
cli: Make patch editable
Add `rad patch edit` to make the patch description editable.
2023-05-05 17:21:53 +02:00
Alexis Sellier c20421b0c6
node: Fix superfluous fetch error on macOS
On macOS, shutting down a socket returns an error if the socket is
already closed. We don't consider that a problem, as it just returns
`Ok(())` on Linux.
2023-05-03 17:20:32 +02:00
Alexis Sellier 0886ab0a3c
node: Get the failing fetch tests passing
We fix the failing fetch tests by:

1. Not verifying our own refs, unless we're cloning, since we're
   otherwise not fetching our own refs.
2. Always force-fetching `sigrefs` from remotes into the staging copy.
3. Making sure that sigref updates are fast-forward before transfering
   the remote into the production copy.
2023-05-03 16:16:34 +02:00
Alexis Sellier 1326774d4f
node: Add failing test for sigrefs fetch
Fetching sigrefs fails if the remote ref is an ancestor of the local ref.
2023-05-03 16:16:34 +02:00
Alexis Sellier 448ef67833
node: Add `Disconnect` command
This is useful especially in tests to disconnect two nodes. We also
expose `command` on the handle type (but not the trait).
2023-05-03 16:16:34 +02:00
Slack Coder 0bfc3f59ee
cli: Auth without ssh-agent
Avoid having ssh-agent a hard dependency of `rad-auth`.

Only add the user's key in `auth::init()` to ssh-agent if it is running,
instead of exiting with error.

For `auth::authenticate()` which is used to authenticate the user with
Radicle, assume using `RAD_PASSPHRASE` is a fallback authentication
method.  If ssh-agent is not-detected, verify the RAD_PASSPHRASE is
present and correct.  Treat neither being present as an error.

Support this by clarifying on `ssh::agent::connect()`s error which are
due to it not being present.
2023-05-03 15:52:33 +02:00
Alexis Sellier 649d59f143
cob: Include head in initial patch entry in DAG
This change ensures that we include as a parent to the initial commit
of a patch COB, the head of the branch we are proposing as a patch.

This was already happening for patch updates, but we forgot to also
include it for the initial patch revision.

This ensures that the code is always fetched alongside the patch.
2023-05-02 09:18:17 +02:00
Alexis Sellier 76eb7c08a1
scripts: Refuse to delete own remote
This can be unrecoverable.
2023-04-29 11:49:35 +02:00
Slack Coder b004fd8afb
rad-issue: Correct formatting 2023-04-28 16:08:44 +02:00
Fintan Halpenny 44a3a09e5c
radicle: check if ref exists when removing a cob
If the reference did not exist it is not necessary to create a new
`sigrefs` entry. Check that the reference exists before removing from
the cob store and only sign if it did.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-04-28 14:28:46 +02:00
Fintan Halpenny 0e6fae5a03
cli: test the deletion of cobs
Ensure that the deletion of cobs is respected by testing a scenario
where a peer creates and then deletes an issue, while another peer
fetches and also has the issue be present and then removed.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-04-28 14:28:46 +02:00
Fintan Halpenny 3bfea69642
node: validate production in debug mode
Ensure that the production repository is validated after fetching and
performing deletions. This is to highlight any inconsistencies that
may show up between fetching and deleting references.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-04-28 14:26:47 +02:00
Fintan Halpenny 024218014b
node: test case for outdated refs
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-04-28 14:26:47 +02:00
Fintan Halpenny 694bd345d9
node: use ls-remote when in fetching mode
Given the scenario of 3 peers, A, B, and C each having a project R. If
peer A has B's fork, but C does not, then when peer A attempts to
fetch from C the fetch will be rejected since Git will fail when a
refspec that is asked for does not exist on the remote side.

To avoid this, the fetch logic is changed so that the client first calls
ls-remote to the remote side, which results in the references that the
remote has which the client is interested in. The follow-up fetch then
uses these refs as the refspecs -- which should succeed unless there
was a race for a deletion on the remote side.

The rest of the verification logic stays the same, so the storage
should still be in a working state before transferring from the staged
repository to the production repository.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-04-28 14:26:47 +02:00
Fintan Halpenny 5a48cdf507
node: ensure that we can fetch with a non-existent tracked node
Ensure that non-existent tracking relationships do not affect
fetching.

This is tested by first performing a clone, by `bob` from `alice`,
after `bob` tracks a remote that does not exist. `alice` creates an
issue which is then fetched by `bob` -- to ensure the fetching
scenario is also tested.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-04-28 14:26:47 +02:00
xphoniex ac12a4deee
cli: Implement `rad node start` with support for deamonizing
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-04-28 14:19:20 +02:00
Erik Kundt 362f26a0c8
tui: Update navigation design 2023-04-28 11:41:33 +02:00
Alexis Sellier 4a99e18562
docs: Update contributor guide 2023-04-28 10:59:31 +02:00
Slack Coder 2667569a6d
cli: Fix patch open/update when out-of-sync
Trying to open or update Patch will fail if the user's working copy is
out of sync with the Radicle projects canonical head.

Fix this by always operating on the storage when opening or
updating a patch.
2023-04-28 10:33:36 +02:00
Erik Kundt e757750398
tui: Fix clippy warnings 2023-04-28 10:27:37 +02:00
Erik Kundt 7c7379c733
tui: Implement new table design for patches 2023-04-28 10:22:58 +02:00
Erik Kundt b1c92f4a0d
tui: New labeled container design 2023-04-28 10:22:58 +02:00
Erik Kundt e268e75280
tui: Add custom block implementation 2023-04-28 10:22:58 +02:00
Erik Kundt 1fa49796ff
tui: Remove obsolete event handling 2023-04-28 10:22:58 +02:00
Alexis Sellier 3e9c3d2679
cob: Don't overwrite nodes during traversal
By not checking if the node exists, if a node is traversed twice,
the second instance of it gets overwritten, and all the edges get
lost.
2023-04-27 14:44:47 +02:00
Vincenzo Palazzo 730eaa00ca
cli: Improve `rad issue show` output
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-04-27 11:48:11 +02:00
Alexis Sellier 83547f9c8a
node: Close worker streams on disconnect
This is in an attempt to fix the worker pool from being backed up.
2023-04-27 11:42:33 +02:00
Alexis Sellier 60fc50644f
cli: Fix `Message::get` bug
We were not propagating the error properly.
2023-04-27 11:22:44 +02:00
Alexis Sellier 44298df48f
Update scripts with a couple of new ones 2023-04-27 11:08:56 +02:00
Alexis Sellier 0ecd8fb074
cli: Add `--draft` to `patch list` command 2023-04-27 10:54:19 +02:00
Alexis Sellier 12a91bd0ae
cli: Create `rad patch ready` command
Allows for converting patches to and from draft mode.
2023-04-26 16:53:24 +02:00
Alexis Sellier f111681dd6
cli: Add `--quiet` option to `patch open` 2023-04-26 16:42:58 +02:00
Alexis Sellier 182c9592c0
cli: Add `--draft` flag to `rad patch open`
Allows opening patches as drafts.
2023-04-26 13:47:43 +02:00
Alexis Sellier 3b20d45d80
cli: Display patches like issues, in `rad patch`
We also make sure not to bail if one of the patches fails to load.
2023-04-26 12:29:32 +02:00
Alexis Sellier b809bd3d73
cli: Force push refs on patch open/update
This ensures that `patch update` does not fail in a non-fast-forward case.
2023-04-26 12:29:32 +02:00