From 0e3f3f03d2bea6764c5f63667f7aa404dfee6708 Mon Sep 17 00:00:00 2001 From: Lorenz Leutgeb Date: Thu, 17 Jul 2025 17:31:34 +0200 Subject: [PATCH] cli: Improve formatting of Node IDs and addresses Pay more attention to when a Node ID is displayed in compact form. As this was sometimes used to save space, e.g. in `rad node status` in combination with long node addresses (like .onion names), also implement a compact format for node addresses and use that instead in some cases. Progress notifications in spinners keep the short form. --- .../examples/git/git-push-amend.md | 2 +- .../examples/git/git-push-canonical-tags.md | 6 +-- .../examples/git/git-push-converge.md | 16 +++---- .../examples/git/git-push-diverge.md | 5 +-- .../examples/git/git-push-rollback.md | 4 +- crates/radicle-cli/examples/git/git-tag.md | 4 +- crates/radicle-cli/examples/rad-clone-all.md | 4 +- .../radicle-cli/examples/rad-clone-connect.md | 2 +- .../examples/rad-clone-directory.md | 2 +- .../examples/rad-clone-partial-fail.md | 16 +++---- crates/radicle-cli/examples/rad-clone.md | 2 +- crates/radicle-cli/examples/rad-fetch.md | 2 +- .../radicle-cli/examples/rad-id-conflict.md | 6 +-- .../examples/rad-id-multi-delegate.md | 6 +-- .../radicle-cli/examples/rad-id-threshold.md | 8 ++-- .../examples/rad-init-private-clone-seed.md | 2 +- .../examples/rad-init-private-clone.md | 6 +-- .../examples/rad-init-private-seed.md | 4 +- crates/radicle-cli/examples/rad-node.md | 10 ++--- .../examples/rad-patch-checkout-force.md | 2 +- .../radicle-cli/examples/rad-patch-delete.md | 4 +- .../examples/rad-patch-pull-update.md | 2 +- .../examples/rad-push-and-pull-patches.md | 2 +- crates/radicle-cli/examples/rad-remote.md | 6 +-- crates/radicle-cli/examples/rad-sync.md | 16 +++---- .../workflow/5-patching-maintainer.md | 2 +- .../workflow/6-pulling-contributor.md | 2 +- crates/radicle-cli/src/commands/checkout.rs | 2 +- crates/radicle-cli/src/commands/clone.rs | 2 +- .../radicle-cli/src/commands/node/control.rs | 12 +++--- .../radicle-cli/src/commands/node/routing.rs | 2 +- crates/radicle-cli/src/commands/sync.rs | 20 ++++----- crates/radicle-cli/src/node.rs | 2 +- crates/radicle-cli/src/terminal/format.rs | 42 +++++++++++++++---- crates/radicle-protocol/src/wire/message.rs | 2 +- crates/radicle/src/node.rs | 10 +++++ 36 files changed, 137 insertions(+), 100 deletions(-) diff --git a/crates/radicle-cli/examples/git/git-push-amend.md b/crates/radicle-cli/examples/git/git-push-amend.md index 59d9dfbe..1dd146f5 100644 --- a/crates/radicle-cli/examples/git/git-push-amend.md +++ b/crates/radicle-cli/examples/git/git-push-amend.md @@ -7,7 +7,7 @@ c036c0d89ce26aef3ad7da402157dba16b5163b4 $ rad sync --fetch Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) -🌱 Fetched from z6MknSL…StBU8Vi +🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ``` ``` ~alice diff --git a/crates/radicle-cli/examples/git/git-push-canonical-tags.md b/crates/radicle-cli/examples/git/git-push-canonical-tags.md index 19e6697b..7a4d4418 100644 --- a/crates/radicle-cli/examples/git/git-push-canonical-tags.md +++ b/crates/radicle-cli/examples/git/git-push-canonical-tags.md @@ -129,7 +129,7 @@ $ rad remote add z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --name alice Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) ✓ Remote alice added -✓ Remote-tracking branch alice/master created for z6MknSL…StBU8Vi +✓ Remote-tracking branch alice/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi $ git push rad master ``` @@ -139,7 +139,7 @@ $ rad remote add z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --name bob Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) ✓ Remote bob added -✓ Remote-tracking branch bob/master created for z6Mkt67…v4N1tRk +✓ Remote-tracking branch bob/master created for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk $ rad id update --title "Add Bob" --delegate did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --no-confirm -q 27ab0d77a95581c59ca9d30e679ceb06a9f758db $ rad id update --title "Update canonical reference rules" --payload xyz.radicle.crefs rules '{ "refs/tags/*": { "threshold": 2, "allow": "delegates" }, "refs/tags/qa/*": { "threshold": 1, "allow": "delegates" } }' -q @@ -154,7 +154,7 @@ editor instead. $ rad sync -f Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) -🌱 Fetched from z6MknSL…StBU8Vi +🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi $ rad id accept dace164ba43fa51802697ec28d0b1965a9d7808b -q ``` diff --git a/crates/radicle-cli/examples/git/git-push-converge.md b/crates/radicle-cli/examples/git/git-push-converge.md index 57c54bba..a73a3776 100644 --- a/crates/radicle-cli/examples/git/git-push-converge.md +++ b/crates/radicle-cli/examples/git/git-push-converge.md @@ -16,16 +16,16 @@ responsibilities: $ rad sync --fetch Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s). ✓ Target met: 2 seed(s) -🌱 Fetched from z6Mkux1…nVhib7Z -🌱 Fetched from z6MknSL…StBU8Vi +🌱 Fetched from z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z +🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ``` ``` ~eve $ rad sync --fetch Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s). ✓ Target met: 2 seed(s) -🌱 Fetched from z6Mkt67…v4N1tRk -🌱 Fetched from z6MknSL…StBU8Vi +🌱 Fetched from z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk +🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ``` To demonstrate the divergence, Alice, Bob, and Eve will all create a new change, @@ -63,13 +63,13 @@ $ rad remote add did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --name Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s). ✓ Target met: 2 seed(s) ✓ Remote bob added -✓ Remote-tracking branch bob/master created for z6Mkt67…v4N1tRk +✓ Remote-tracking branch bob/master created for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk $ rad remote add did:key:z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z --name eve ✓ Follow policy updated for z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z (eve) Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s). ✓ Target met: 2 seed(s) ✓ Remote eve added -✓ Remote-tracking branch eve/master created for z6Mkux1…nVhib7Z +✓ Remote-tracking branch eve/master created for z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z ``` Alice does indeed have Bob and Eve's references, however, a new canonical @@ -104,7 +104,7 @@ $ rad remote add did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --name Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s). ✓ Target met: 2 seed(s) ✓ Remote alice added -✓ Remote-tracking branch alice/master created for z6MknSL…StBU8Vi +✓ Remote-tracking branch alice/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi $ git reset --hard alice/master HEAD is now at 0f9bd80 Merge remote-tracking branch 'eve/master' ``` @@ -130,7 +130,7 @@ $ rad remote add did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --name Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s). ✓ Target met: 2 seed(s) ✓ Remote alice added -✓ Remote-tracking branch alice/master created for z6MknSL…StBU8Vi +✓ Remote-tracking branch alice/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi $ git reset --hard alice/master HEAD is now at 0f9bd80 Merge remote-tracking branch 'eve/master' ``` diff --git a/crates/radicle-cli/examples/git/git-push-diverge.md b/crates/radicle-cli/examples/git/git-push-diverge.md index 2364ec32..5d0ff736 100644 --- a/crates/radicle-cli/examples/git/git-push-diverge.md +++ b/crates/radicle-cli/examples/git/git-push-diverge.md @@ -1,4 +1,3 @@ - Let's see what happens if we try to push a head which diverges from the canonical head. @@ -15,7 +14,7 @@ Then, as Bob, we commit some code on top of the canonical head: $ rad sync --fetch Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) -🌱 Fetched from z6MknSL…StBU8Vi +🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi $ rad inspect --delegates did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (alice) did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk (bob) @@ -32,7 +31,7 @@ longer canonical, since Bob pushed a more recent commit, and the threshold is 1: ``` ~alice $ rad remote add did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --fetch --no-sync ✓ Remote bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk added -✓ Remote-tracking branch bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk/master created for z6Mkt67…v4N1tRk +✓ Remote-tracking branch bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk/master created for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk $ git branch -arv bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk/master 319a7dc Third commit rad/master f2de534 Second commit diff --git a/crates/radicle-cli/examples/git/git-push-rollback.md b/crates/radicle-cli/examples/git/git-push-rollback.md index d54f3fac..8cc297b8 100644 --- a/crates/radicle-cli/examples/git/git-push-rollback.md +++ b/crates/radicle-cli/examples/git/git-push-rollback.md @@ -14,7 +14,7 @@ Bob then syncs these changes and adds a new commit: $ rad sync --fetch Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) -🌱 Fetched from z6MknSL…StBU8Vi +🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi $ git commit -m "Third commit" --allow-empty -q $ git push rad $ git branch -arv @@ -27,7 +27,7 @@ Alice merges these changes and pushes them, which updates the canonical head: ``` ~alice $ rad remote add did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --name bob --fetch --no-sync ✓ Remote bob added -✓ Remote-tracking branch bob/master created for z6Mkt67…v4N1tRk +✓ Remote-tracking branch bob/master created for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk $ git merge bob/master Updating f2de534..319a7dc Fast-forward diff --git a/crates/radicle-cli/examples/git/git-tag.md b/crates/radicle-cli/examples/git/git-tag.md index 7ce21e61..80b23697 100644 --- a/crates/radicle-cli/examples/git/git-tag.md +++ b/crates/radicle-cli/examples/git/git-tag.md @@ -40,7 +40,7 @@ $ rad remote add z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --name alice Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) ✓ Remote alice added -✓ Remote-tracking branch alice/master created for z6MknSL…StBU8Vi +✓ Remote-tracking branch alice/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ``` Bob is able to fetch Alice's tag into his working copy, and they're fetched @@ -76,7 +76,7 @@ update of the tag: $ rad sync -f Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) -🌱 Fetched from z6MknSL…StBU8Vi +🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ``` ``` ~bob (stderr) diff --git a/crates/radicle-cli/examples/rad-clone-all.md b/crates/radicle-cli/examples/rad-clone-all.md index 59a86ae7..d139b7b5 100644 --- a/crates/radicle-cli/examples/rad-clone-all.md +++ b/crates/radicle-cli/examples/rad-clone-all.md @@ -5,7 +5,7 @@ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential s ✓ Target met: 1 seed(s) ✓ Creating checkout in ./heartwood.. ✓ Remote alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi added -✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSL…StBU8Vi +✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ✓ Repository successfully cloned under [..]/heartwood/ ╭────────────────────────────────────╮ │ heartwood │ @@ -53,7 +53,7 @@ We can then setup a git remote for `bob`: ``` $ rad remote add z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --name bob --no-sync --fetch ✓ Remote bob added -✓ Remote-tracking branch bob/master created for z6Mkt67…v4N1tRk +✓ Remote-tracking branch bob/master created for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk $ git branch --remotes alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master bob/master diff --git a/crates/radicle-cli/examples/rad-clone-connect.md b/crates/radicle-cli/examples/rad-clone-connect.md index b42e5280..169ede97 100644 --- a/crates/radicle-cli/examples/rad-clone-connect.md +++ b/crates/radicle-cli/examples/rad-clone-connect.md @@ -8,7 +8,7 @@ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential s ✓ Target met: 1 seed(s) ✓ Creating checkout in ./heartwood.. ✓ Remote alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi added -✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSL…StBU8Vi +✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ✓ Repository successfully cloned under [..]/heartwood/ ╭────────────────────────────────────╮ │ heartwood │ diff --git a/crates/radicle-cli/examples/rad-clone-directory.md b/crates/radicle-cli/examples/rad-clone-directory.md index f64ede02..93a21b25 100644 --- a/crates/radicle-cli/examples/rad-clone-directory.md +++ b/crates/radicle-cli/examples/rad-clone-directory.md @@ -8,7 +8,7 @@ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential s ✓ Target met: 1 seed(s) ✓ Creating checkout in ./Developer/Radicle.. ✓ Remote alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi added -✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSL…StBU8Vi +✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ✓ Repository successfully cloned under [..]/Developer/Radicle/ ╭────────────────────────────────────╮ │ heartwood │ diff --git a/crates/radicle-cli/examples/rad-clone-partial-fail.md b/crates/radicle-cli/examples/rad-clone-partial-fail.md index ac2988a4..d16cc040 100644 --- a/crates/radicle-cli/examples/rad-clone-partial-fail.md +++ b/crates/radicle-cli/examples/rad-clone-partial-fail.md @@ -2,13 +2,13 @@ Eve knows about three seeds. ``` $ rad node routing -╭─────────────────────────────────────────────────────╮ -│ RID NID │ -├─────────────────────────────────────────────────────┤ -│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji z6MknSL…StBU8Vi │ -│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji z6MksFq…bS9wzpT │ -│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji z6Mkt67…v4N1tRk │ -╰─────────────────────────────────────────────────────╯ +╭──────────────────────────────────────────────────────────────────────────────────────╮ +│ RID NID │ +├──────────────────────────────────────────────────────────────────────────────────────┤ +│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │ +│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji z6MksFqXN3Yhqk8pTJdUGLwBTkRfQvwZXPqR2qMEhbS9wzpT │ +│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk │ +╰──────────────────────────────────────────────────────────────────────────────────────╯ ``` When she tries to clone, one of those will fail to fetch. But the clone command still returns successfully. @@ -20,7 +20,7 @@ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 3 potential s ✓ Target met: 1 seed(s) ✓ Creating checkout in ./heartwood.. ✓ Remote alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi added -✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSL…StBU8Vi +✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ✓ Repository successfully cloned under [..]/heartwood/ ╭────────────────────────────────────╮ │ heartwood │ diff --git a/crates/radicle-cli/examples/rad-clone.md b/crates/radicle-cli/examples/rad-clone.md index b5a88662..7eab6124 100644 --- a/crates/radicle-cli/examples/rad-clone.md +++ b/crates/radicle-cli/examples/rad-clone.md @@ -8,7 +8,7 @@ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found [..] potentia ✓ Target met: [..] seed(s) ✓ Creating checkout in ./heartwood.. ✓ Remote alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi added -✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSL…StBU8Vi +✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ✓ Repository successfully cloned under [..]/heartwood/ ╭────────────────────────────────────╮ │ heartwood │ diff --git a/crates/radicle-cli/examples/rad-fetch.md b/crates/radicle-cli/examples/rad-fetch.md index fb3f601f..43a35986 100644 --- a/crates/radicle-cli/examples/rad-fetch.md +++ b/crates/radicle-cli/examples/rad-fetch.md @@ -21,7 +21,7 @@ by passing the `--fetch` option. $ rad sync --fetch rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) -🌱 Fetched from z6MknSL…StBU8Vi +🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ``` However, we don't have a local fork of the project. We can follow this diff --git a/crates/radicle-cli/examples/rad-id-conflict.md b/crates/radicle-cli/examples/rad-id-conflict.md index e0a9ecf7..90ec0ab5 100644 --- a/crates/radicle-cli/examples/rad-id-conflict.md +++ b/crates/radicle-cli/examples/rad-id-conflict.md @@ -9,7 +9,7 @@ $ cd heartwood $ rad sync --fetch rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) -🌱 Fetched from z6MknSL…StBU8Vi +🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ``` One thing that can happen is that two delegates propose a revision at the same @@ -31,7 +31,7 @@ revisions. $ rad sync --fetch rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) -🌱 Fetched from z6Mkt67…v4N1tRk +🌱 Fetched from z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk $ rad id list ╭─────────────────────────────────────────────────────────────────────────────────╮ │ ● ID Title Author Status Created │ @@ -66,7 +66,7 @@ accepted now. $ rad sync --fetch rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) -🌱 Fetched from z6MknSL…StBU8Vi +🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ``` ``` ~bob (fail) $ rad id accept 12d7300 -q diff --git a/crates/radicle-cli/examples/rad-id-multi-delegate.md b/crates/radicle-cli/examples/rad-id-multi-delegate.md index b7250721..69273aa3 100644 --- a/crates/radicle-cli/examples/rad-id-multi-delegate.md +++ b/crates/radicle-cli/examples/rad-id-multi-delegate.md @@ -8,7 +8,7 @@ $ rad watch --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --node z6Mkux1aUQD2voWWukVb $ rad sync --fetch rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) -🌱 Fetched from z6MknSL…StBU8Vi +🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi $ rad id --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji ╭────────────────────────────────────────────────────────────────────────────────╮ │ ● ID Title Author Status Created │ @@ -60,8 +60,8 @@ $ rad id update --repo rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --title "Add Eve" --des $ rad sync --fetch rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s). ✓ Target met: 2 seed(s) -🌱 Fetched from z6Mkux1…nVhib7Z -🌱 Fetched from z6Mkt67…v4N1tRk +🌱 Fetched from z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z +🌱 Fetched from z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk $ rad inspect rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --delegates did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi (alice) did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk (bob) diff --git a/crates/radicle-cli/examples/rad-id-threshold.md b/crates/radicle-cli/examples/rad-id-threshold.md index fe434a17..fb53f26d 100644 --- a/crates/radicle-cli/examples/rad-id-threshold.md +++ b/crates/radicle-cli/examples/rad-id-threshold.md @@ -98,7 +98,7 @@ errors: $ rad sync rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji -f Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) -🌱 Fetched from z6MknSL…StBU8Vi +🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ``` We can also inspect the repository to ensure all the data is @@ -175,7 +175,7 @@ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential s ✓ Target met: 1 seed(s) ✓ Creating checkout in ./heartwood.. ✓ Remote alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi added -✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSL…StBU8Vi +✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ✓ Repository successfully cloned under [..]/bob/heartwood/ ╭────────────────────────────────────╮ │ heartwood │ @@ -195,8 +195,8 @@ $ rad fork $ rad sync -f Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s). ✓ Target met: 2 seed(s) -🌱 Fetched from z6Mkux1…nVhib7Z -🌱 Fetched from z6Mkt67…v4N1tRk +🌱 Fetched from z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z +🌱 Fetched from z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk $ rad inspect --sigrefs z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ae3c6b77dc1ed51c1c1e6a2772339c2779fa9ba8 z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk dace6fe948548168a2bb687718949d9b5d9076ee diff --git a/crates/radicle-cli/examples/rad-init-private-clone-seed.md b/crates/radicle-cli/examples/rad-init-private-clone-seed.md index 3ad87ba6..99c5088e 100644 --- a/crates/radicle-cli/examples/rad-init-private-clone-seed.md +++ b/crates/radicle-cli/examples/rad-init-private-clone-seed.md @@ -35,7 +35,7 @@ Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from the network, found 1 potential s ✓ Target met: 1 preferred seed(s). ✓ Creating checkout in ./heartwood.. ✓ Remote alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi added -✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSL…StBU8Vi +✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ✓ Repository successfully cloned under [...]/.radicle/heartwood/ ╭────────────────────────────────────╮ │ heartwood │ diff --git a/crates/radicle-cli/examples/rad-init-private-clone.md b/crates/radicle-cli/examples/rad-init-private-clone.md index d1f9c2a6..6598511b 100644 --- a/crates/radicle-cli/examples/rad-init-private-clone.md +++ b/crates/radicle-cli/examples/rad-init-private-clone.md @@ -8,9 +8,9 @@ $ rad ls $ rad clone rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu --seed z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --timeout 1 ✓ Seeding policy updated for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu with scope 'all' Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from the network, found 1 potential seed(s). -✗ Target not met: could not fetch from [z6MknSL…StBU8Vi], and required 1 more seed(s) +✗ Target not met: could not fetch from [z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi], and required 1 more seed(s) ! Warning: Failed to fetch from 1 seed(s). -! Warning: z6MknSL…StBU8Vi: failed to perform fetch handshake +! Warning: z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi: failed to perform fetch handshake ✗ Error: no seeds found for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu ``` @@ -31,7 +31,7 @@ that Alice has the repo after she announced her refs: $ rad sync rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu --fetch Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) -🌱 Fetched from z6MknSL…StBU8Vi +🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi $ rad ls --private --all ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ Name RID Visibility Head Description │ diff --git a/crates/radicle-cli/examples/rad-init-private-seed.md b/crates/radicle-cli/examples/rad-init-private-seed.md index 364add4a..987061a4 100644 --- a/crates/radicle-cli/examples/rad-init-private-seed.md +++ b/crates/radicle-cli/examples/rad-init-private-seed.md @@ -26,7 +26,7 @@ He has to specify a seed that isn't in his routing table: $ rad sync rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu --fetch --seed z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from the network, found 1 potential seed(s). ✓ Target met: 1 preferred seed(s). -🌱 Fetched from z6MknSL…StBU8Vi +🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ``` ``` ~bob @@ -45,5 +45,5 @@ seed succeeds. $ rad sync rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu --fetch --seed z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --seed z6MkwPUeUS2fJMfc2HZN1RQTQcTTuhw4HhPySB8JeUg2mVvx Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) -🌱 Fetched from z6MknSL…StBU8Vi +🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ``` diff --git a/crates/radicle-cli/examples/rad-node.md b/crates/radicle-cli/examples/rad-node.md index 8a0ec5f2..f6a5406d 100644 --- a/crates/radicle-cli/examples/rad-node.md +++ b/crates/radicle-cli/examples/rad-node.md @@ -65,11 +65,11 @@ created. ``` $ rad node routing -╭─────────────────────────────────────────────────────╮ -│ RID NID │ -├─────────────────────────────────────────────────────┤ -│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji z6MknSL…StBU8Vi │ -╰─────────────────────────────────────────────────────╯ +╭──────────────────────────────────────────────────────────────────────────────────────╮ +│ RID NID │ +├──────────────────────────────────────────────────────────────────────────────────────┤ +│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi │ +╰──────────────────────────────────────────────────────────────────────────────────────╯ ``` Finally, if we want to stop the daemon process from running we can diff --git a/crates/radicle-cli/examples/rad-patch-checkout-force.md b/crates/radicle-cli/examples/rad-patch-checkout-force.md index 56732ccb..8983eaf5 100644 --- a/crates/radicle-cli/examples/rad-patch-checkout-force.md +++ b/crates/radicle-cli/examples/rad-patch-checkout-force.md @@ -26,7 +26,7 @@ $ cd heartwood $ rad sync -f Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) -🌱 Fetched from z6MknSL…StBU8Vi +🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi $ rad patch checkout aa45913 --name alice-init ✓ Switched to branch alice-init at revision aa45913 ✓ Branch alice-init setup to track rad/patches/aa45913e757cacd46972733bddee5472c78fa32a diff --git a/crates/radicle-cli/examples/rad-patch-delete.md b/crates/radicle-cli/examples/rad-patch-delete.md index 5e085646..e1c6235f 100644 --- a/crates/radicle-cli/examples/rad-patch-delete.md +++ b/crates/radicle-cli/examples/rad-patch-delete.md @@ -21,8 +21,8 @@ $ cd heartwood $ rad sync -f Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s). ✓ Target met: 2 seed(s) -🌱 Fetched from z6MknSL…StBU8Vi -🌱 Fetched from z6Mkux1…nVhib7Z +🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi +🌱 Fetched from z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z $ rad patch comment 6c61ef1 -m "I think we should use MIT" ╭───────────────────────────╮ │ bob (you) now 833db19 │ diff --git a/crates/radicle-cli/examples/rad-patch-pull-update.md b/crates/radicle-cli/examples/rad-patch-pull-update.md index 5fcd89ff..294bbdbc 100644 --- a/crates/radicle-cli/examples/rad-patch-pull-update.md +++ b/crates/radicle-cli/examples/rad-patch-pull-update.md @@ -27,7 +27,7 @@ Fetching rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK from the network, found 1 potential se ✓ Target met: 1 seed(s) ✓ Creating checkout in ./heartwood.. ✓ Remote alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi added -✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSL…StBU8Vi +✓ Remote-tracking branch alice@z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi/master created for z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ✓ Repository successfully cloned under [..]/heartwood/ ╭────────────────────────────────────╮ │ heartwood │ diff --git a/crates/radicle-cli/examples/rad-push-and-pull-patches.md b/crates/radicle-cli/examples/rad-push-and-pull-patches.md index b935f185..0ca7df08 100644 --- a/crates/radicle-cli/examples/rad-push-and-pull-patches.md +++ b/crates/radicle-cli/examples/rad-push-and-pull-patches.md @@ -20,7 +20,7 @@ $ rad remote add z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) ✓ Remote bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk added -✓ Remote-tracking branch bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk/master created for z6Mkt67…v4N1tRk +✓ Remote-tracking branch bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk/master created for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk $ git checkout master -q $ cat .git/FETCH_HEAD f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 not-for-merge branch 'master' of rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk diff --git a/crates/radicle-cli/examples/rad-remote.md b/crates/radicle-cli/examples/rad-remote.md index f9c1acfd..88584b99 100644 --- a/crates/radicle-cli/examples/rad-remote.md +++ b/crates/radicle-cli/examples/rad-remote.md @@ -3,7 +3,7 @@ Now, let's add a bob as a new remote: ``` $ rad remote add did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --name bob --no-sync ✓ Remote bob added -✓ Remote-tracking branch bob/master created for z6Mkt67…v4N1tRk +✓ Remote-tracking branch bob/master created for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk ``` Now, we can see that there is a new remote in the list of remotes: @@ -41,7 +41,7 @@ able to fetch the node alias from our db! ``` $ rad remote add did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --no-sync ✓ Remote bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk added -✓ Remote-tracking branch bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk/master created for z6Mkt67…v4N1tRk +✓ Remote-tracking branch bob@z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk/master created for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk ``` We can also use `rad remote` to list all the remotes that are @@ -70,7 +70,7 @@ let's add them to our set of working copy remotes: ``` $ rad remote add did:key:z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z --name eve --no-sync ✓ Remote eve added -✓ Remote-tracking branch eve/master created for z6Mkux1…nVhib7Z +✓ Remote-tracking branch eve/master created for z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z ``` After adding `eve`'s remote, we no longer see any entries that are diff --git a/crates/radicle-cli/examples/rad-sync.md b/crates/radicle-cli/examples/rad-sync.md index e3381c9b..d55d7fbd 100644 --- a/crates/radicle-cli/examples/rad-sync.md +++ b/crates/radicle-cli/examples/rad-sync.md @@ -57,8 +57,8 @@ We can also use the `--fetch` option to only fetch objects: $ rad sync --fetch Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s). ✓ Target met: 2 seed(s) -🌱 Fetched from z6Mkux1…nVhib7Z -🌱 Fetched from z6Mkt67…v4N1tRk +🌱 Fetched from z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z +🌱 Fetched from z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk ``` Specifying both `--fetch` and `--announce` is equivalent to specifying none: @@ -67,8 +67,8 @@ Specifying both `--fetch` and `--announce` is equivalent to specifying none: $ rad sync --fetch --announce Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s). ✓ Target met: 2 seed(s) -🌱 Fetched from z6Mkux1…nVhib7Z -🌱 Fetched from z6Mkt67…v4N1tRk +🌱 Fetched from z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z +🌱 Fetched from z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk ✓ Nothing to announce, already in sync with 2 seed(s) (see `rad sync status`) ``` @@ -78,7 +78,7 @@ It's also possible to use the `--seed` flag to only sync with a specific node: $ rad sync --fetch --seed z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 3 potential seed(s). ✓ Target met: 1 preferred seed(s). -🌱 Fetched from z6Mkt67…v4N1tRk +🌱 Fetched from z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk ``` And the `--replicas` flag to sync with a number of nodes. First we'll @@ -92,7 +92,7 @@ $ rad issue open --title "Test `rad sync --replicas`" --description "Check that $ rad sync --replicas 1 Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s). ✓ Target met: 1 seed(s) -🌱 Fetched from z6Mkux1…nVhib7Z +🌱 Fetched from z6Mkux1aUQD2voWWukVb5nNUR7thrHveQG4pDQua8nVhib7Z ✓ Synced with 1 seed(s) ``` @@ -118,10 +118,10 @@ Or when trying to fetch from an unknown seed, using `--seed`: ``` $ rad sync --fetch rad:z39mP9rQAaGmERfUMPULfPUi473tY --seed z6MkjM3HpqNVV4ZsL5s3RAd8ThVG3VG98YsDCjHBNnGMq5o7 Fetching rad:z39mP9rQAaGmERfUMPULfPUi473tY from the network, found 1 potential seed(s). -✗ Target not met: could not fetch from [z6MkjM3…nGMq5o7], and required 1 more seed(s) +✗ Target not met: could not fetch from [z6MkjM3HpqNVV4ZsL5s3RAd8ThVG3VG98YsDCjHBNnGMq5o7], and required 1 more seed(s) ✗ Error: Fetched from 0 preferred seed(s), could not reach 1 seed(s) ✗ Error: Could not replicate from 1 preferred seed(s) -✗ Error: z6MkjM3…nGMq5o7: Could not connect. No addresses known. +✗ Error: z6MkjM3HpqNVV4ZsL5s3RAd8ThVG3VG98YsDCjHBNnGMq5o7: Could not connect. No addresses known. ``` Also note that you cannot sync an unseeded repo: diff --git a/crates/radicle-cli/examples/workflow/5-patching-maintainer.md b/crates/radicle-cli/examples/workflow/5-patching-maintainer.md index ae7661e7..b5eb6db6 100644 --- a/crates/radicle-cli/examples/workflow/5-patching-maintainer.md +++ b/crates/radicle-cli/examples/workflow/5-patching-maintainer.md @@ -11,7 +11,7 @@ $ rad remote add z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --name bob --s Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) ✓ Remote bob added -✓ Remote-tracking branch bob/master created for z6Mkt67…v4N1tRk +✓ Remote-tracking branch bob/master created for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk ``` The contributor's changes are now visible to us. diff --git a/crates/radicle-cli/examples/workflow/6-pulling-contributor.md b/crates/radicle-cli/examples/workflow/6-pulling-contributor.md index a3544946..a34dfbfe 100644 --- a/crates/radicle-cli/examples/workflow/6-pulling-contributor.md +++ b/crates/radicle-cli/examples/workflow/6-pulling-contributor.md @@ -12,7 +12,7 @@ Then, we call `rad sync --fetch` to fetch from the maintainer: $ rad sync --fetch Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) -🌱 Fetched from z6MknSL…StBU8Vi +🌱 Fetched from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ``` Now let's checkout `master` and pull the maintainer's changes: diff --git a/crates/radicle-cli/src/commands/checkout.rs b/crates/radicle-cli/src/commands/checkout.rs index 1e77243e..7c2b6255 100644 --- a/crates/radicle-cli/src/commands/checkout.rs +++ b/crates/radicle-cli/src/commands/checkout.rs @@ -178,7 +178,7 @@ pub fn setup_remote( term::success!( "Remote-tracking branch {} created for {}", term::format::tertiary(branch), - term::format::tertiary(term::format::node(remote_id)) + term::format::tertiary(term::format::node_id_human(remote_id)) ); } Ok(remote_name) diff --git a/crates/radicle-cli/src/commands/clone.rs b/crates/radicle-cli/src/commands/clone.rs index c8120d5c..5f4ad7c7 100644 --- a/crates/radicle-cli/src/commands/clone.rs +++ b/crates/radicle-cli/src/commands/clone.rs @@ -355,7 +355,7 @@ fn handle_fetch_error(id: RepoId, failure: &node::sync::fetch::TargetMissed) -> for (node, reason) in failure.fetch_results().failed() { term::warning(format!( "{}: {}", - term::format::node(node), + term::format::node_id_human(node), term::format::yellow(reason), )) } diff --git a/crates/radicle-cli/src/commands/node/control.rs b/crates/radicle-cli/src/commands/node/control.rs index 453f4800..49f46c07 100644 --- a/crates/radicle-cli/src/commands/node/control.rs +++ b/crates/radicle-cli/src/commands/node/control.rs @@ -189,7 +189,7 @@ pub fn connect( ) -> anyhow::Result<()> { let spinner = term::spinner(format!( "Connecting to {}@{addr}...", - term::format::node(&nid) + term::format::node_id_human_compact(&nid) )); match node.connect( nid, @@ -217,7 +217,7 @@ pub fn connect_many( for addr in addrs { spinner.message(format!( "Connecting to {}@{addr}...", - term::format::node(&nid) + term::format::node_id_human_compact(&nid) )); match node.connect( nid, @@ -353,7 +353,7 @@ pub fn sessions(node: &Node) -> Result>, node table.divider(); for sess in sessions { - let nid = term::format::tertiary(term::format::node(&sess.nid)).into(); + let nid = term::format::tertiary(term::format::node_id_human(&sess.nid)).into(); let (addr, state, time) = match sess.state { node::State::Initial => ( term::Label::blank(), @@ -361,17 +361,17 @@ pub fn sessions(node: &Node) -> Result>, node term::Label::blank(), ), node::State::Attempted => ( - sess.addr.to_string().into(), + term::format::addr_compact(&sess.addr).into(), term::Label::from(state_attempted()), term::Label::blank(), ), node::State::Connected { since, .. } => ( - sess.addr.to_string().into(), + term::format::addr_compact(&sess.addr).into(), term::Label::from(state_connected()), term::format::dim(now - since).into(), ), node::State::Disconnected { since, .. } => ( - sess.addr.to_string().into(), + term::format::addr_compact(&sess.addr).into(), term::Label::from(state_disconnected()), term::format::dim(now - since).into(), ), diff --git a/crates/radicle-cli/src/commands/node/routing.rs b/crates/radicle-cli/src/commands/node/routing.rs index bcb50411..77ff0165 100644 --- a/crates/radicle-cli/src/commands/node/routing.rs +++ b/crates/radicle-cli/src/commands/node/routing.rs @@ -36,7 +36,7 @@ fn print_table(entries: impl IntoIterator) { for (rid, nid) in entries { t.push([ term::format::highlight(rid.to_string()), - term::format::node(&nid), + term::format::node_id_human(&nid), ]); } t.print(); diff --git a/crates/radicle-cli/src/commands/sync.rs b/crates/radicle-cli/src/commands/sync.rs index f0738cfc..69c9abe3 100644 --- a/crates/radicle-cli/src/commands/sync.rs +++ b/crates/radicle-cli/src/commands/sync.rs @@ -674,8 +674,8 @@ impl FetcherSpinner { term::format::secondary(self.preferred_seeds), term::format::secondary(progress.succeeded()), term::format::secondary(self.replicas.lower_bound()), - term::format::tertiary(term::format::node(node)), - term::format::tertiary(addr), + term::format::tertiary(term::format::node_id_human_compact(node)), + term::format::tertiary(term::format::addr_compact(addr)), )) } @@ -691,8 +691,8 @@ impl FetcherSpinner { term::format::secondary(self.preferred_seeds), term::format::secondary(progress.succeeded()), term::format::secondary(self.replicas.lower_bound()), - term::format::tertiary(term::format::node(node)), - term::format::tertiary(addr), + term::format::tertiary(term::format::node_id_human_compact(node)), + term::format::tertiary(term::format::addr_compact(addr)), )) } @@ -731,7 +731,7 @@ impl FetcherSpinner { let missing_preferred_seeds = missed .missed_nodes() .iter() - .map(|nid| term::format::node(nid).to_string()) + .map(|nid| term::format::node_id_human(nid).to_string()) .collect::>(); let required = missed.required_nodes(); if !missing_preferred_seeds.is_empty() { @@ -760,7 +760,7 @@ fn display_fetch_result(result: &sync::FetcherResult, verbose: bool) { for (node, reason) in results.failed() { term::warning(format!( "{}: {}", - term::format::node(node), + term::format::node_id_human(node), term::format::yellow(reason), )) } @@ -784,7 +784,7 @@ fn display_fetch_result(result: &sync::FetcherResult, verbose: bool) { for (node, reason) in results.failed() { term::error(format!( "{}: {}", - term::format::node(node), + term::format::node_id_human(node), term::format::negative(reason), )) } @@ -803,7 +803,7 @@ fn display_success<'a>( for (node, updates, _) in results { term::println( "🌱 Fetched from", - term::format::secondary(term::format::node(node)), + term::format::secondary(term::format::node_id_human(node)), ); if verbose { let mut updates = updates @@ -858,7 +858,7 @@ fn print_announcer_result(result: &sync::AnnouncerResult, verbose: bool) { if verbose { print_synced(result.synced()); for node in timed_out { - term::warning(format!("{} timed out", term::format::node(node))); + term::warning(format!("{} timed out", term::format::node_id_human(node))); } } } @@ -873,7 +873,7 @@ fn print_announcer_result(result: &sync::AnnouncerResult, verbose: bool) { fn print_synced(synced: &BTreeMap) { for (node, status) in synced.iter() { - let mut message = format!("🌱 Synced with {}", term::format::node(node)); + let mut message = format!("🌱 Synced with {}", term::format::node_id_human(node)); match status { sync::announce::SyncStatus::AlreadySynced => { diff --git a/crates/radicle-cli/src/node.rs b/crates/radicle-cli/src/node.rs index 571bb361..41e58310 100644 --- a/crates/radicle-cli/src/node.rs +++ b/crates/radicle-cli/src/node.rs @@ -242,7 +242,7 @@ where match node.announce(rid, settings.timeout, announcer, |node, progress| { spinner.message(format!( "Synced with {}, {} of {} preferred seeds, and {} of at least {} replica(s).", - term::format::node(node), + term::format::node_id_human_compact(node), term::format::secondary(progress.preferred()), term::format::secondary(n_preferred_seeds), term::format::secondary(progress.synced()), diff --git a/crates/radicle-cli/src/terminal/format.rs b/crates/radicle-cli/src/terminal/format.rs index 99b48047..77422e28 100644 --- a/crates/radicle-cli/src/terminal/format.rs +++ b/crates/radicle-cli/src/terminal/format.rs @@ -8,7 +8,7 @@ pub use radicle_term::{style, Paint}; use radicle::cob::ObjectId; use radicle::identity::Visibility; use radicle::node::policy::Policy; -use radicle::node::{Alias, AliasStore, NodeId}; +use radicle::node::{Address, Alias, AliasStore, HostName, NodeId}; use radicle::prelude::Did; use radicle::profile::{env, Profile}; use radicle::storage::RefUpdate; @@ -17,7 +17,7 @@ use radicle_term::element::Line; use crate::terminal as term; /// Format a node id to be more compact. -pub fn node(node: &NodeId) -> Paint { +pub fn node_id_human_compact(node: &NodeId) -> Paint { let node = node.to_human(); let start = node.chars().take(7).collect::(); let end = node.chars().skip(node.len() - 7).collect::(); @@ -25,6 +25,32 @@ pub fn node(node: &NodeId) -> Paint { Paint::new(format!("{start}…{end}")) } +/// Format a node id. +pub fn node_id_human(node: &NodeId) -> Paint { + Paint::new(node.to_human()) +} + +pub fn addr_compact(address: &Address) -> Paint { + let host = match address.host() { + HostName::Ip(ip) => ip.to_string(), + HostName::Dns(dns) => dns.clone(), + HostName::Tor(onion) => { + let onion = onion.to_string(); + let start = onion.chars().take(8).collect::(); + let end = onion + .chars() + .skip(onion.len() - 8 - ".onion".len()) + .collect::(); + format!("{start}…{end}") + } + _ => unreachable!(), + }; + + let port = address.port().to_string(); + + Paint::new(format!("{host}:{port}")) +} + /// Format a git Oid. pub fn oid(oid: impl Into) -> Paint { Paint::new(format!("{:.7}", oid.into())) @@ -173,7 +199,7 @@ impl fmt::Display for Identity<'_> { let nid = self.profile.id(); let alias = self.profile.aliases().alias(nid); let node_id = match self.short { - true => self::node(nid).to_string(), + true => self::node_id_human_compact(nid).to_string(), false => nid.to_human(), }; @@ -231,13 +257,15 @@ impl<'a> Author<'a> { pub fn labels(self) -> (term::Label, term::Label) { let alias = match self.alias.as_ref() { Some(alias) => term::format::primary(alias).into(), - None if self.you => term::format::primary(term::format::node(self.nid)) - .dim() - .into(), + None if self.you => { + term::format::primary(term::format::node_id_human_compact(self.nid)) + .dim() + .into() + } None => term::Label::blank(), }; let author = self.you().unwrap_or_else(|| { - term::format::primary(term::format::node(self.nid)) + term::format::primary(term::format::node_id_human_compact(self.nid)) .dim() .into() }); diff --git a/crates/radicle-protocol/src/wire/message.rs b/crates/radicle-protocol/src/wire/message.rs index 765185b7..864bb0f3 100644 --- a/crates/radicle-protocol/src/wire/message.rs +++ b/crates/radicle-protocol/src/wire/message.rs @@ -2,7 +2,7 @@ use std::{mem, net}; use bytes::Buf; use bytes::BufMut; -use cyphernet::addr::{tor, Addr, HostName, NetAddr}; +use cyphernet::addr::{tor, HostName, NetAddr}; use radicle::crypto::Signature; use radicle::git::Oid; use radicle::identity::RepoId; diff --git a/crates/radicle/src/node.rs b/crates/radicle/src/node.rs index 52c53a94..93939aff 100644 --- a/crates/radicle/src/node.rs +++ b/crates/radicle/src/node.rs @@ -573,6 +573,16 @@ impl Address { _ => true, } } + + /// Return the [`HostName`] of the [`Address`]. + pub fn host(&self) -> &HostName { + &self.0.host + } + + /// Return the port number of the [`Address`]. + pub fn port(&self) -> u16 { + self.0.port + } } impl cyphernet::addr::Host for Address {