From 6ca7da276839e5217b340dbfff8cd9095d8464c5 Mon Sep 17 00:00:00 2001 From: cloudhead Date: Fri, 1 Dec 2023 13:56:04 +0100 Subject: [PATCH] radicle: Rename many more methods using new naming --- .../{rad-track.md => rad-seed-and-follow.md} | 7 +- radicle-cli/src/commands/clean.rs | 2 +- radicle-cli/src/commands/follow.rs | 4 +- radicle-cli/src/commands/init.rs | 16 +- radicle-cli/src/commands/inspect.rs | 4 +- radicle-cli/src/commands/ls.rs | 2 +- radicle-cli/src/commands/node/policies.rs | 8 +- radicle-cli/src/commands/patch/common.rs | 2 +- radicle-cli/src/commands/seed.rs | 4 +- radicle-cli/src/commands/sync.rs | 4 +- radicle-cli/src/commands/unfollow.rs | 4 +- radicle-cli/src/project.rs | 20 +- radicle-cli/tests/commands.rs | 6 +- radicle-fetch/src/handle.rs | 16 +- radicle-fetch/src/lib.rs | 4 +- radicle-fetch/src/{tracking.rs => policy.rs} | 28 +-- radicle-fetch/src/stage.rs | 23 ++- radicle-fetch/src/state.rs | 6 +- radicle-httpd/src/api.rs | 6 +- radicle-httpd/src/api/v1/delegates.rs | 10 +- radicle-httpd/src/api/v1/node.rs | 10 +- radicle-httpd/src/api/v1/projects.rs | 12 +- radicle-httpd/src/test.rs | 2 +- radicle-node/src/control.rs | 2 +- radicle-node/src/runtime.rs | 18 +- radicle-node/src/runtime/handle.rs | 8 +- radicle-node/src/service.rs | 177 +++++++++--------- radicle-node/src/test/environment.rs | 22 +-- radicle-node/src/test/handle.rs | 12 +- radicle-node/src/test/peer.rs | 8 +- radicle-node/src/tests.rs | 46 +++-- radicle-node/src/tests/e2e.rs | 8 +- radicle-node/src/worker.rs | 18 +- radicle-node/src/worker/fetch.rs | 8 +- radicle/src/node.rs | 4 +- radicle/src/node/config.rs | 4 +- radicle/src/node/policy.rs | 2 +- radicle/src/node/policy/config.rs | 30 +-- radicle/src/node/policy/store.rs | 170 +++++++++-------- radicle/src/profile.rs | 44 ++--- radicle/src/storage/git.rs | 2 +- 41 files changed, 383 insertions(+), 400 deletions(-) rename radicle-cli/examples/{rad-track.md => rad-seed-and-follow.md} (60%) rename radicle-fetch/src/{tracking.rs => policy.rs} (79%) diff --git a/radicle-cli/examples/rad-track.md b/radicle-cli/examples/rad-seed-and-follow.md similarity index 60% rename from radicle-cli/examples/rad-track.md rename to radicle-cli/examples/rad-seed-and-follow.md index 8ea21175..5d01db94 100644 --- a/radicle-cli/examples/rad-track.md +++ b/radicle-cli/examples/rad-seed-and-follow.md @@ -1,12 +1,13 @@ -To configure our node's tracking policy, we can use the `rad track` command. -For example, let's track a remote node we know about, and alias it to "eve": +To configure our node's seeding and follow policy, we can use the `rad seed` +and `rad follow` commands. +For example, let's follow a remote node we know about, and alias it to "eve": ``` $ rad follow did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --alias eve ✓ Follow policy updated for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk (eve) ``` -Now let's track one of Eve's repositories: +Now let's seed one of Eve's repositories: ``` $ rad seed rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --scope followed --no-fetch diff --git a/radicle-cli/src/commands/clean.rs b/radicle-cli/src/commands/clean.rs index 19e099c9..31dd55f6 100644 --- a/radicle-cli/src/commands/clean.rs +++ b/radicle-cli/src/commands/clean.rs @@ -22,7 +22,7 @@ Usage local operator or a delegate of the repository. Note that remotes will still be fetched as long as they are - tracked and/or the tracking scope is "all". + followed and/or the follow scope is "all". Options diff --git a/radicle-cli/src/commands/follow.rs b/radicle-cli/src/commands/follow.rs index f2e7a891..a2fa1eaa 100644 --- a/radicle-cli/src/commands/follow.rs +++ b/radicle-cli/src/commands/follow.rs @@ -100,8 +100,8 @@ pub fn follow( let followed = match node.follow(nid, alias.clone()) { Ok(updated) => updated, Err(e) if e.is_connection_err() => { - let mut config = profile.tracking_mut()?; - config.track_node(&nid, alias.as_deref())? + let mut config = profile.policies_mut()?; + config.follow(&nid, alias.as_deref())? } Err(e) => return Err(e.into()), }; diff --git a/radicle-cli/src/commands/init.rs b/radicle-cli/src/commands/init.rs index 88110b23..7aa9b493 100644 --- a/radicle-cli/src/commands/init.rs +++ b/radicle-cli/src/commands/init.rs @@ -60,7 +60,7 @@ pub struct Options { pub scope: Scope, pub set_upstream: bool, pub verbose: bool, - pub track: bool, + pub seed: bool, } impl Args for Options { @@ -77,7 +77,7 @@ impl Args for Options { let mut set_upstream = false; let mut setup_signing = false; let mut scope = Scope::All; - let mut track = true; + let mut seed = true; let mut verbose = false; let mut visibility = None; @@ -129,8 +129,8 @@ impl Args for Options { Long("no-confirm") => { interactive = Interactive::No; } - Long("no-track") => { - track = false; + Long("no-seed") => { + seed = false; } Long("private") => { visibility = Some(Visibility::private([])); @@ -161,7 +161,7 @@ impl Args for Options { interactive, set_upstream, setup_signing, - track, + seed, visibility, verbose, }, @@ -279,10 +279,10 @@ pub fn init(options: Options, profile: &profile::Profile) -> anyhow::Result<()> term::blob(json::to_string_pretty(&proj)?); } - // It's important to track our own repositories to make sure that our node signals + // It's important to seed our own repositories to make sure that our node signals // interest for them. This ensures that messages relating to them are relayed to us. - if options.track { - cli::project::track(id, options.scope, &mut node, profile)?; + if options.seed { + cli::project::seed(id, options.scope, &mut node, profile)?; } if options.set_upstream || git::branch_remote(&repo, proj.default_branch()).is_err() { diff --git a/radicle-cli/src/commands/inspect.rs b/radicle-cli/src/commands/inspect.rs index 7085e9fc..8ed465a4 100644 --- a/radicle-cli/src/commands/inspect.rs +++ b/radicle-cli/src/commands/inspect.rs @@ -173,8 +173,8 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> { } } Target::Policy => { - let tracking = profile.tracking()?; - if let Some(repo) = tracking.repo_policy(&rid)? { + let tracking = profile.policies()?; + if let Some(repo) = tracking.seed_policy(&rid)? { let tracking = match repo.policy { Policy::Allow => term::format::positive("tracked"), Policy::Block => term::format::negative("blocked"), diff --git a/radicle-cli/src/commands/ls.rs b/radicle-cli/src/commands/ls.rs index d65310a5..aa94c712 100644 --- a/radicle-cli/src/commands/ls.rs +++ b/radicle-cli/src/commands/ls.rs @@ -17,7 +17,7 @@ Usage rad ls [