Commit Graph

288 Commits

Author SHA1 Message Date
Alexis Sellier a1674600e9
cli: Fix merge commit oid
We were storing the commit *before* the merge in the COB, instead of
storing the commit *after* the merge.
2023-05-16 21:11:57 +02:00
Alexis Sellier 8202495e24
cli: Rework `rad sync` command
By default, `rad sync` will both fetch and announce now.

To only fetch or only announce, the `--fetch` or `--announce` flags
can be used.
2023-05-15 15:34:45 +02:00
Alexis Sellier f72b448114
cli: Fix `rad patch show` with merged patches
We were not correctly calculating the base commit. Simply
using the latest revision base does the job for now.
2023-05-15 12:22:09 +02:00
Alexis Sellier a9c0152a99
cli: Use library for updating patch
Also improves the message from a bare revision id.
2023-05-15 12:22:09 +02:00
Alexis Sellier 51dced4808
cli: Use library for opening patch
Instead of calling `rad patch open`, use `patch::create` directly.

Also outputs the patch id for the user.
2023-05-15 12:22:09 +02:00
Slack Coder ad48514ddd
cli: Fix workflow test
'git pull' in workflow/6-pulling-contributor causes a message to be
emitted for some git versions.  It asks to configure 'git pull's default
action.

Use '--ff' as a workaround as a git config file is unsupported, and no
environment variable exists for this configuration.
2023-05-14 13:50:20 +02:00
Alexis Sellier e7cc32a278
cli: Update some of the output formatting 2023-05-12 13:09:42 +02:00
Alexis Sellier dd7d86abb0
cli: Update examples to use new `fail` decorator 2023-05-12 12:54:21 +02:00
Alexis Sellier 103ee4e23d
cli: Show commit listing in `rad patch show` 2023-05-12 12:43:44 +02:00
Alexis Sellier fd1237b2db
cli: Use `git push` to open or update patches
This adds the ability to the git-remote-helper to open and update
patches via a `git push` to the magic ref `refs/patches` and
`refs/heads/patches/<patch-id>`.

The main change is that we had to move away from offering the `connect`
capability in the remote helper, to offering `push` and `fetch`
individually.

To get a feel for how this works, see the `rad-patch-via-push.md`
example.
2023-05-12 12:22:08 +02:00
Alexis Sellier f8ee109aaa
cli: Set a working `EDITOR` env var in tests
Previously, commands would just fail. Now it runs the `true` command
that always returns success.
2023-05-12 11:09:21 +02:00
Alexis Sellier d249937a61
Update dependencies
* radicle-surf
* radicle-git-ext
* amplify
2023-05-10 15:56:21 +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
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
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 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
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
Slack Coder b004fd8afb
rad-issue: Correct formatting 2023-04-28 16:08:44 +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
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
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
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 60fc50644f
cli: Fix `Message::get` bug
We were not propagating the error properly.
2023-04-27 11:22:44 +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
Alexis Sellier 3a9c8b7144
radicle: Remove `delegate` from `Remote` type
It wasn't being set correctly, and it's not the place for it,
so we remove it and set it in `httpd`.

Note that `Remote` is now simply a wrapper around `SignedRefs`.
If we want to remove the type or turn it into an alias, it will
require touching lots of different parts of the codebase. I opted
not to do that here as it's lower priority.
2023-04-26 11:06:55 +02:00
Alexis Sellier 7a08a1d459
cli: Get fetch after track working
When tracking a repository with the `--fetch` option, we run a fetch
once the tracking is done.

When tracking nodes, we don't accept the `--fetch` flag, as there may
not be a repository to fetch.
2023-04-26 09:49:37 +02:00
Vincenzo Palazzo 8d1bf9e997
cli: Show a message when there are no issues to display
This commit fixes the inconsistency with the `rad patch` command,
which previously displayed an empty table when there were no issues. Now,
the CLI will display a message indicating that there are no issues to display.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-04-26 00:58:09 +02:00
Alexis Sellier 3ea7541d55
cli: Replace seedling emoji with alien invader
To match the new branding, we remove seedlings and sometimes replace
them with alien invaders.
2023-04-25 12:47:36 +02:00
Alexis Sellier 7d72b16087
cli: Call `rad sync` on `git push rad`
Instead of `Node::announce_refs`, we call `rad sync` to have the
terminal block while waiting for nodes to fetch the changes.

We also change the use of `git push` in the patch command to not
trigger syncing in that case.
2023-04-25 12:46:25 +02:00
Alexis Sellier 6346931ce2
cli: Add canonical remote to `init` and `checkout`
Add a remote that points to the canonical upstream.
2023-04-24 15:42:00 +02:00
Alexis Sellier d6cebf613f
cli: Remove `rad fetch` command
The command is replaced with `rad sync --fetch`. Soon, it will be called
from the git-remote-helper, so users won't have to call it explicitly.
2023-04-24 14:19:31 +02:00
Alexis Sellier a285943166
cli: Remove `rad push` command
Users should use `git push` or `git push rad` instead.
2023-04-24 14:19:24 +02:00
Alexis Sellier 671c169244
node: Implement `rad sync` command
This command announces refs to peers and waits for them to be
in sync.

Adds a subscribe method to `Handle` so that we can get the events
from the seed to allow us to confirm that the configured seeds fetched
from us.
2023-04-24 11:39:37 +02:00
Alexis Sellier 86feebe4d8
cli: Add `--quiet` flag to `rad issue` 2023-04-24 11:29:42 +02:00
Vincenzo Palazzo 5a4d0fff3f
tests: add radicle command test for the rad remote
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-04-22 14:10:23 +02:00
Vincenzo Palazzo d55861572d
cli: accept from the cli the remote subcommand
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-04-22 14:09:30 +02:00
Vincenzo Palazzo fb44af9653
cli: implement the rad remote rm command
Implementing the `rad remote rm` command in order to be able
to remote a remote inside the radicle remote list.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-04-22 14:09:30 +02:00