Commit Graph

1533 Commits

Author SHA1 Message Date
cloudhead ecb59d687b
cob: Return `RevisionId` instead of `Revision`
Previously we panicked if a revision wasn't found after an update. But
it can happen that the update goes through yet a concurrent update
prevents the revision from being valid.

To partially deal with this, we don't try to lookup the revision after
an update, we simply return the ID. This means a subsequent lookup can
fail, and the error can be handled there.
2023-12-13 12:14:06 +01:00
cloudhead 57e3b2a154
cli: Add timeout option to `rad watch` 2023-12-13 12:14:06 +01:00
cloudhead 0e8a64d0f8
cli: Better handling of missing refs in `watch` 2023-12-13 12:14:06 +01:00
cloudhead 74a0d7a4d2
cli: Fix `rad seed --delete` command
There was a bug due to `--delete` not being treated properly as a
sub-command.
2023-12-12 11:02:07 +01:00
cloudhead bfdf82a69a
node: Small initialization changes
* Connect to nodes at the end, not the beginning
* Skip sync-status stuff if we're not seeding the repo
* Move debug message to be higher signal
2023-12-11 16:29:39 +01:00
cloudhead 472a1e6545
cli: Add `watch` command
Allows watching and waiting for refs to change. This is especially useful for
tests. For now, we don't show it in the output of `rad`.
2023-12-11 12:04:26 +01:00
cloudhead 5af8f70665
cli: Fix `rev` argument parsing
We were using the `oid` function incorrectly, which has been changed
to actually return an OID.
2023-12-11 12:04:26 +01:00
cloudhead 8196027f35
cli: Allow force-push with single delegates
It's not currently possible to force-push rad/master if it's not a
rollback, even if you are the only delegate. Since there is no risk
in doing that, we allow it in this patch.
2023-12-11 11:28:29 +01:00
cloudhead 9aee9b2436
cli: Corrections to patch/issue help text 2023-12-06 12:07:31 +01:00
cloudhead 6ca7da2768
radicle: Rename many more methods using new naming 2023-12-06 10:02:00 +01:00
cloudhead 1b026ae0ee
node: Rename node `tracking` module 2023-12-06 10:00:45 +01:00
cloudhead e65595c4c7
node: Rename commands with new "seed" nomenclature 2023-12-06 09:56:58 +01:00
cloudhead f453090e27
cli: Consolidate policy/scope variants
* Policy::Track -> Policy::Allow
* Scope::Trusted -> Scope::Followed
2023-12-06 09:56:58 +01:00
cloudhead 4605348d68
cli: From "tracking" to "seeding" and "following"
Split the commands and change the naming.

* Tracking a repo is now called "seeding"
* Tracking a peer is now called "following"

In this commit, we don't change most of the internal code, only the
user-facing part.
2023-12-06 09:56:57 +01:00
Fintan Halpenny ee9ee69130
cli: move rad review to rad patch
It is more natural for the review command to exist as a subcommand of
patch, since the reviews are for patches.

Remove the `rad review` command, moving its functionality to the `rad
patch` command. The rad-patch.md and rad-review-by-hunk.md tests are
modified to use the `rad patch review` command.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-12-06 09:51:55 +01:00
Fintan Halpenny 6a3a66ae9c
cli: simplify `Message` default
Use the derive and `#[default]` mechanism for deriving the default of
`Message`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-12-06 09:51:47 +01:00
Fintan Halpenny 3681c0e6df
cli: rename remove to delete
Rename the --remove options to --delete for assign and label, to be
more consistent with review, and let this be the standard.

Clean up any typos around labels/dids and issues/patches.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-12-06 09:48:02 +01:00
Fintan Halpenny 67cbf15e45
cli: unify label and unlabel
Make the CLI easier by unifying the label and unlabel, using `--add`
and `--remove` options instead.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-12-06 09:48:02 +01:00
Fintan Halpenny d32a10b4b9
cli: move rad assign/unassign under rad issue and rad patch
It is more natural for the assign and unassign commands to exist as
subcommands of the object they are assigning to, i.e. issues and
patches.

Remove the rad assign and rad unassign commands, moving their
functionality to the rad issue and rad patch commands. The
rad-issue.md and rad-patch.md tests are modified to include a assign
test.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-12-06 09:48:02 +01:00
Fintan Halpenny dce5316cbb
radicle: rename Issue::assigned -> Issue::assignees
Align the naming with the field itself and Patch::assignees.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-12-06 09:48:02 +01:00
Sebastian Martinez 3e07808ee5
httpd: Add node policies endpoint
New endpoint on `PUT api/v1/node/policies/repos/:rid` and `DELETE api/v1/node/policies/repos/:rid`,
that allows to track and untrack a project.

For tracking a project we also accept `?from=<nid>` to specify
where we should fetch from after tracking a repo.
2023-12-05 16:07:22 +01:00
Sebastian Martinez f8005c74c6
httpd: Add comment edits to serialized json
This allows the display of any edits done to comments,
replies and issue descriptions.

This commit doesn't remove the body property
which is the latest comment body but adds a edits property.

Also adds an author property to the `Edit` struct,
which allows us to see the author of an edit action.
2023-12-05 16:01:50 +01:00
Fintan Halpenny 924a2624a4
git: update git2-0.18.1
Update to git2-0.18.1, which also requires updating radicle-git-ext
and radicle-surf.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-12-04 11:11:36 +00:00
cloudhead 0decad5586
cli: Fix sorting of `rad sync status` 2023-12-01 12:51:56 +01:00
Lars Wirzenius fe396ed5f4
man: Make structure a little closer to convention
Conventionally, manual page have a FILES and an ENVIRONMENT top level
section, instead of sub-sections. Following convention makes it easier
and faster for experienced Unix users to find what they need.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2023-11-30 17:01:58 +01:00
Fintan Halpenny 1af9480b08
cli: Move label commands to `issue` and `patch`
It is more natural for the label and unlabel commands to exist as
subcommands of the object they are labelling, i.e. issues and
patches.

Remove the `rad label` and `rad unlabel` commands, moving their
functionality to the `rad issue` and `rad patch` commands. The
`rad-issue.md` and `rad-patch.md` tests are modified to include a
label test.

The `rad patch show` command did not support showing labels as part of
its output. This was also included to confirm the test above was working.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-11-30 14:02:37 +01:00
Fintan Halpenny 511165bfc5
fetch: prevent missing default branch
If a delegate is missing the default branch for a project certain
computations will fail, e.g. getting the canonical mainline branch.

One prevention for corrupting data is refusing to fetch a delegate
that does not have the default branch, when the repository is a
project. It is assumed that the repository is not a project if calling
`Doc::project` returns an error, since the error variants are not
found and parsing errors.

This is only checked in the case of a delegate since non-delegates are
safe to created COBs that don't require the default branch,
e.g. creating an issue.
2023-11-30 13:50:39 +01:00
cloudhead 9341d51d05
cli: Make sure diff stats match `git` 2023-11-30 13:02:51 +01:00
cloudhead af095d53ca
radicle: Add foreign-key constraint for routing 2023-11-30 13:00:59 +01:00
cloudhead 6b04eff34c
radicle: Consolidate databases
Instead of having a routing database, and an addresses database,
consolidate that in a single database called `node.db`.

We also simplify database access, by providing a single type for opening
the database, and use traits to access the various functions.

We create a new `seed::Store` that has seed-related methods split out of
the `address::Store`.

Note that tracking is still in its own database currently, as it isn't
ephemeral state. This makes it easy to delete the new `node.db` without
risk of losing any important information.

To avoid renaming all database methods, we create a `Stores` wrapper
that allows us to access routing, addresses, seeds etc. without type
ambiguity.

This is a breaking change and requires `addresses.db` and `routing.db`
to be deleted.
2023-11-30 13:00:59 +01:00
Lars Wirzenius df785aa0bf
cli: Add filtering based on author to `rad patch`
My use case for this is to have a script that lists my outstanding
patches so I can ping people for review or merge if there's no
movement for a long time.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2023-11-30 12:56:29 +01:00
Fintan Halpenny 72b00e3d41
cli: sort-by flag for rad sync
Allow the caller of `rad sync` to `--sort-by` the NID, alias, or
status of the seeds.

This prevents random ordering, due to timestamps, in CLI testing.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-11-30 12:46:18 +01:00
Sebastian Martinez 9ae7fd702e
httpd: Add endpoint with tracking information
This allows us to check which projects are really tracked by the node
and which aren't and with which scopes and policies.
2023-11-30 12:30:07 +01:00
Fintan Halpenny 0af233cceb
cli: prevent missing delegate being added
It's necessary for a delegate's references to be present, e.g.
verification, calculating of canonical data, etc.

To ensure that a user does not get themselves into a state where they
have added a delegate without their references, prevent adding a
delegate to the identity document if their `rad/sigrefs` is not
present.

As well as this, it ensures that if there is a `rad/sigrefs` that it
has the default branch -- since it's possible for a peer to have created
`rad/sigrefs` through COBs without a default branch.

This change meant that the `rad-id` tests required the test scenarios
to be set up with all nodes having each other's references. A test
case to add a missing delegate was also added to `rad-id.md`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-11-30 12:20:16 +01:00
Fintan Halpenny bb5fb5e9d9
cli: fix rad-push-and-pull-patches
The call to `rad sync -a` can end up with different output if the `git
push` has already announced to the network -- ending up with the nodes
already be in sync.

Instead, for consistency, leave the syncing up to the `git push` and
remove the call to `rad sync`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-11-30 10:19:40 +00:00
cloudhead 538ca1e44d
cob: Don't lose state when lifecycling
It was previously possible to switch a merged patch to "open", losing
the merge state.
2023-11-30 10:53:09 +01:00
Fintan Halpenny 5b1cdbaa4a
radicle: remove repo iff there's no local rad/sigrefs
If the local peer does not have any `rad/sigrefs` then there is no
risk of any data corruption. In this case the repository can be
removed entirely.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-11-30 10:48:14 +01:00
Fintan Halpenny 5f96429005
radicle: remove `WriteStorage::remove`
The `remove` method is no longer being used, with `clean` taking its
place.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-11-30 10:48:14 +01:00
cloudhead ad7a3addb6
cli: Add `rad config` command
Displays the current configuration.

Also move to our tree-sitter highlighter for pretty-printing JSON and
remove the `json-color` dependency.
2023-11-30 10:46:32 +01:00
cloudhead 59a08f21a4
radicle: Explorer and preferred seed configuration
Allows users to configure the default node explorer to use.
Allows users to configure their preferred seeds.
2023-11-30 10:46:32 +01:00
cloudhead 3ad97fde0b
node: Small fix to sync-status
We weren't correctly updating the sync status for the local node
previously.
2023-11-27 16:35:14 +01:00
Sebastian Martinez 638c2a3e4c
httpd: Announce refs in project POST/PATCH routes 2023-11-24 13:47:14 +01:00
Sebastian Martinez 1cbca28b7c
httpd: Use a simpler way of obtaining a Blob without a commit 2023-11-24 13:42:30 +01:00
Sebastian Martinez 8277559ee0
Update radicle-surf to 0.17.1 2023-11-24 13:42:30 +01:00
Fintan Halpenny 0fb1128bd3
cli: rework `rad rm` as `rad clean`
Removing a repository completely can result in data corruption for
users, since a user's `rad/sigrefs` are the ground truth of their
state, and any fork of them results in errors in the protocol.

Instead of `rad rm`, we replace it with `rad clean` that removes all
remotes other than the local peer's namespace and the delegates'. The
delegates are also necessary to keep, since the repository's identity
is dependent on them.

Note that the remotes that were cleaned will be populated again upon
fetching, as long as they are tracked.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-11-24 10:48:06 +00:00
Fintan Halpenny d23120ca8b
radicle: add clean method
Add a `clean` method to remove the remotes of a repository that are
not the local peer nor the delegates.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-11-24 10:48:05 +00:00
cloudhead 53013f306f
cli: Improve `rad ls`
Distinguish between repos that are simply tracked, vs. repos that are
cloned (and thus forked). By default, we don't show repos that don't
have a local fork.
2023-11-23 13:51:47 +01:00
cloudhead 2917198d1c
radicle: Fix `config.json` issue
This allows the config to load without a `cli` key.
2023-11-23 13:51:47 +01:00
cloudhead 7d67dd6cb6
remote-helper: Add hint about updating patch 2023-11-23 11:07:07 +01:00
cloudhead 8e76ce03d5
cli: Hints system
Enable hints by default, but allow users to turn them off via
configuration.

Add a hint when pushing while offline.
2023-11-23 11:07:07 +01:00