Commit Graph

67 Commits

Author SHA1 Message Date
cloudhead 6349c1c559
cli: Small change to output for clarity
So that users don't confuse the revision id with a commit id, we
explicitly state it's a new revision id.
2024-01-08 17:46:22 +01:00
Fintan Halpenny f90421a6bb
cli: sync on patch and issue updates
When we perform updates to cobs we tend to want to sync those changes
to the network after. This patch automatically does this for
operations that perform updates to issues and patches.

Note that `--announce` becomes the default for the `rad patch`
command.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-12-19 14:19:55 +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 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 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
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 82a53e3a53
radicle: UserInfo for Repository::create
The fetch V2 improvements introduced a `UserInfo` type that is used to
set the Git config's name and email when cloning a repository. This
`UserInfo` can also be used when creating a new `Repository`.

The `Storage` type now takes a `UserInfo` so that it can be passed to
`Repository::create`, for creating a new repository.

For testing, this requires adding a new `fixtures::user` so that
testing `Storage` instances can be easily constructed.

It also means that the `radicle-cli` tests all changed with new SHAs
since the name and email are used as part of the hashing input.

N.b. the order of the timelines while testing the identity cob
changed. It's not clear why that is.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-11-09 16:43:34 +01:00
Fintan Halpenny 2584ecdb0a
radicle: Pin timestamp for testing
When testing the CLI, "since"-calculations will result in different
values over time:

    now
    1 month ago
    2 months ago
    10 months ago
    1 year ago
    10 years ago

Initially, the solution was to use the wildcard match from `snapbox`,
`[..]`, to match on these values. However, since these values change
in length it means that they will affect the width of the tables
produced by the CLI.

To ensure the width is stable across runs over time it's possible to
use a time that is the same as the commit time used at testing.

To do this the `Timestamp` type is now a newtype which has a
constructor `now` which will use the `RAD_COMMIT_TIME` env variable
for construction, if it's available and in debug mode. This ensure
that all "since"-calculations will result in `now`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-10-30 14:48:38 +01:00
cloudhead 1d167581f2
cob: Introduce `xyz.radicle.id` COB
Introduces a new COB type to store repository identity documents.

The reason for this change is to:

1. Simplify the code, as the identity document logic resembled a COB,
   yet it had custom logic. This allows existing COB code to be used for
   identities.
2. Make identity document update logic more flexible, since COB actions
   can be added in the future.
3. Re-purpose existing tools around COBs to work on identities, eg. `rad
   cob`.
4. Unify the concept of an identity change proposal, with regular identity
   changes. This means we can remove the `id.proposal` COB in favor of
   using the `id` COB itself.

Notes
-----

* Each repository has one Identity COB.
* The `Proposal` COB has been repurposed into the `Identity` COB.
* Identity documents are stored as *embeds* inside the Identity COB
  actions.
* The action that contains new document versions is called `revision`,
  just like the Patches COB.
* The namespaced `rad/id` ref is a symbolic reference to that Identity
  COB.
* The canonical `rad/id` ref is a direct reference to the commit in the
  Identity COB that contains the latest *accepted* revision of the
  document.
* All commands for managing identities have been folded into `rad id`.
  Hence `rad delegate` and `rad edit` are removed.
* The concept of "rebasing" an identity document is gone.
* The `rad id` output has been updated to match the style of other
  commands.
* When a revision has enough signatures, it is automatically adopted as
  the current identity, there is no longer the need for a "commit"
  action.
* When an identity revision is proposed, and the current identity has a
  threshold of `1`, that identity is automatically accepted due to the
  above point.
* The idea of "verifying a peer's identity branch" no longer applies, as
  COBs cannot be verified one history at a time.
* Since the root commit of the Identity COB does not have a "Resource"
  to point to (it would have to point to itself, which is impossible),
  we've made the resource id optional for COBs.
2023-10-12 17:32:33 +02:00
cloudhead 7abfd4870c
term: Overhaul rendering
The `Element::render` function now takes a constraint object. This
allows the parent element to influence how the child is rendered. This
is useful eg. to have elements take up more space than they need to fill
some space.

We also make various changes needed for pretty diffs, such as merging
styles, a new `Filled` type, and some color theming.
2023-09-27 12:37:41 +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 6c5cba3ca6
cli: Improve patch and issue outputs
* Add author to `issue show`
* Improve author display with alias
* Fix consistency issues when printing authors
2023-09-01 12:26:43 +02:00
Alexis Sellier 3bd5589b1a
cob: Stabilize formats
> I'm going to be making a set of breaking changes to COBs in order to
stabilize the data formats. This is hopefully a one-time change that
bundles various breaking changes.

All COBs have been reworked: issue, patch, id.

The changes included are:

* Revise the assign and tag actions to take a single list of
  assignees/tags to set, instead of an "add" and a "remove" list. This
  makes API usage simpler when editing issues, and simplifies the apply
  function
* Rename "tags" to "labels", and the tag action to label. This is
  because tag is confusing in the context of git, as it could mean a git
  tag. Using label removes that confusion.
* Use DIDs instead of PublicKeys for assignees -- this is more
  future-proof
* Modify the manifest file format in the COB tree. Mainly, remove the
  `history_type` key which is redundant, and use camelCase for keys
* Flatten the `Thread` actions into the parent action type
* Ensure that operations on redacted objects do not fail, since
  redactions could have happened concurrently
* Use a consistent naming scheme for actions, using `.` as separator
* Consolidate comment types and remove `CodeComment`, by adding an
  optional `location` field to `Comment`
* Add many placeholder actions that are not yet implemented

To preserve backwards compatibility, a `legacy` module is created with
the old `apply` function. When loading the manifest, we check whether it
is a legacy COB or a "stable" COB, and in the legacy case, use the
legacy code to materialize the state and then convert the object into
the stable type. Eventually, we'll delete the legacy code.
2023-08-07 11:05:14 +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
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 3d803b2498
cli: Remove `rad patch open`
Remove this command in favor of the `git push` flow.

We also remove the `rad/patches` remote configuration which wasn't
working properly with `git fetch --all`.
2023-06-07 15:57:11 +02:00
Alexis Sellier ac60069a33
cob: Remove `description` from `Patch`
Since patches always have a "root" revision, use that revision's description
as the patch description.
2023-05-26 10:31:00 +02:00
xphoniex 95e3b9673d
cli: Show alias on `rad issue` and `rad patch`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-05-22 15:13:28 +02:00
Alexis Sellier 90237e8e9d
cli: Fix some tests that are no longer valid 2023-05-17 16:54:30 +02:00
Alexis Sellier 103ee4e23d
cli: Show commit listing in `rad patch show` 2023-05-12 12:43:44 +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 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 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 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 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 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 442e8a7128
cli: Cleanup patch examples a little 2023-04-22 13:59:18 +02:00
Alexis Sellier 6f17a4db67
cli: Don't show patch diff by default
It can be re-enabled with `-p`, which is what git uses usually.
2023-04-20 16:56:06 +02:00
Slack Coder 11d10b4e47
cli-test: Support '[..]'s which preserve spacing
By mapping all '[.. ]'s  with any number of spaces inside them into
'[..]'s, examples can preserve text formatting while using this glob
pattern.

The downside is failed output will show '[..]' in place of the original
version with spaces.
2023-04-20 16:52:20 +02:00
Alexis Sellier eecea67ffd
cob: Deduplicate change parents 2023-04-14 13:54:27 +02:00
Alexis Sellier 97f076e3cf
Include dependencies for certain COB actions
We ensure that for example, the given commits are fetched before the
revision or merge actions in a patch.
2023-04-14 13:22:10 +02:00
Alexis Sellier 9db63a8801
cli: Cleanup patch, checkout and clone output
Remove extra whitespace, start moving away from sprout.
2023-04-12 12:02:38 +02:00
Alexis Sellier c1face7cd8
cli: Fix and simplify `rad review`
* Properly remove review help message from review
* Remove `--no-confirm` and confirmation step

The CLI should be mostly non-interactive for day-to-day commands,
keeping the interactivity for the TUI.
2023-04-10 10:27:52 +02:00
Alexis Sellier 6b44955cd9
cli: Show timeline in `patch show` 2023-04-04 21:19:50 +02:00
Alexis Sellier b6fa4a4b2a
cli: Some improvements to `rad merge` 2023-04-03 16:06:24 +02:00
Alexis Sellier 6fb6cff708
term: Add border support for tables 2023-03-27 17:46:32 +02:00
Alexis Sellier 8dba01d6ae
cli: Improve patch command output
* Fix timeline ordering
* Remove spinner noise
* Add revisions to timeline
2023-03-24 13:04:52 +01:00
Vincenzo Palazzo 654a21b2b3
cli: Allow git revision parameters as COB IDs
This commit allows any git revision to be used instead
of the full SHA-1, when specifying COBs.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-03-22 15:38:14 +01:00
Alexis Sellier db8ec5735f
cli: Use new widgets for `patch list` 2023-03-21 12:43:44 +01:00
Alexis Sellier ab74e54949
term: Implement new output widget system
We implement a new `Element` trait which allows for more complex output
to be drawn, such as vertical and horizontal stacks.

We adapt `Table` to work within this system.

We refresh the output of `rad patch show` to use these new tools.
2023-03-21 12:43:44 +01:00
Slack Coder b6c1560a0a
cli: add workflow example with two peers
Make the documentation more realistic by using two peers, a maintainer
and a contributor, for the client examples.  Define them as 'workflow'
examples, ordering them in their own directory to aid user navigation.
2023-03-20 18:27:58 +01:00
Alexis Sellier 5ccf38079c
cli: Make `patch checkout` fetch missing objects
Before this change, `rad patch checkout` would fail if the patch commits
were not in the working copy.
2023-03-18 12:24:17 +01:00
Slack Coder 166f7e7cc2
cli: Minimize patch info on creation
Reduce noise when showing patch information to the user on creation by
only showing the git branch name and not the commit reference.
2023-03-11 18:38:54 +01:00
Alexis Sellier 34a2d1a9dc
cli: use canonical head for patch target
Correct assumptions made about how patching work in `rad patch`.  Make
the default Patch target a `git ref` in place of a target 'peer'.

Use the canonical head as the git reference.  This is head of the
project's master branch which project delegates have concensus on.
2023-03-11 18:38:54 +01:00
Alexis Sellier aacacf872f
cob: Use `EntryId` as the operation identifier
By introducing a small limitation: only allowing entries in the change
graph to be addressable, instead of individual operations; we
drastically simplify the CRDT implementation.

There are four advantages:

1. Op ids are just regular SHA-1s
2. There's no need for relative IDs, ops never refer to other ops within the
   same commit
3. There's no need for a nonce, since commits can't collide, and neither can op IDs
4. `OpId` can just be an alias of `EntryId`

The disadvantage of course, is that we have to be mindful of how we
create op transactions, since each transaction creates an addressable
unit. For example, we must not include multiple patch revisions in the
same transaction.
2023-03-09 17:08:56 +01:00
Alexis Sellier adbf6f5bf5
cli: Improve `patch` command
Cleanup and simplify output of patch command.
2023-03-08 20:23:49 +01:00
Alexis Sellier 9000a626d7
Use commit oid for COB parent
We were using the blob oid, which was causing the commit tree to
be invalid.
2023-03-06 15:39:34 +01:00