From d6cebf613f7be0d5d06fa55e10301e46a2bf1705 Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Mon, 24 Apr 2023 14:15:09 +0200 Subject: [PATCH] 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. --- radicle-cli/examples/rad-fetch.md | 2 +- .../workflow/5-patching-maintainer.md | 2 +- radicle-cli/src/commands.rs | 2 - radicle-cli/src/commands/clone.rs | 4 +- radicle-cli/src/commands/fetch.rs | 143 ------------------ radicle-cli/src/commands/help.rs | 1 - radicle-cli/src/commands/patch.rs | 4 +- radicle-cli/src/commands/remote/add.rs | 16 +- radicle-cli/src/commands/sync.rs | 105 ++++++++++++- radicle-cli/src/main.rs | 8 - radicle/src/profile.rs | 10 +- 11 files changed, 122 insertions(+), 175 deletions(-) delete mode 100644 radicle-cli/src/commands/fetch.rs diff --git a/radicle-cli/examples/rad-fetch.md b/radicle-cli/examples/rad-fetch.md index 16b0db2a..96d3d256 100644 --- a/radicle-cli/examples/rad-fetch.md +++ b/radicle-cli/examples/rad-fetch.md @@ -18,7 +18,7 @@ Now that the project is tracked we can fetch it and we will have it in our local storage. ``` -$ rad fetch rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji +$ rad sync --fetch rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji ✓ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from z6MknSL…StBU8Vi.. ✓ Fetched repository from 1 seed(s) ``` diff --git a/radicle-cli/examples/workflow/5-patching-maintainer.md b/radicle-cli/examples/workflow/5-patching-maintainer.md index 40efbc28..b5bd4a00 100644 --- a/radicle-cli/examples/workflow/5-patching-maintainer.md +++ b/radicle-cli/examples/workflow/5-patching-maintainer.md @@ -6,7 +6,7 @@ Changes have been proposed by another person (or peer) via a radicle patch. To $ rad track did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk --alias bob ✓ Tracking policy updated for z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk (bob) ! Warning: fetch after track is not yet supported -$ rad fetch +$ rad sync --fetch ✓ Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from z6Mkt67…v4N1tRk.. ✓ Fetched repository from 1 seed(s) ``` diff --git a/radicle-cli/src/commands.rs b/radicle-cli/src/commands.rs index 8edd79c1..309bcffd 100644 --- a/radicle-cli/src/commands.rs +++ b/radicle-cli/src/commands.rs @@ -12,8 +12,6 @@ pub mod rad_comment; pub mod rad_delegate; #[path = "commands/edit.rs"] pub mod rad_edit; -#[path = "commands/fetch.rs"] -pub mod rad_fetch; #[path = "commands/fork.rs"] pub mod rad_fork; #[path = "commands/help.rs"] diff --git a/radicle-cli/src/commands/clone.rs b/radicle-cli/src/commands/clone.rs index 58ea293d..875fde63 100644 --- a/radicle-cli/src/commands/clone.rs +++ b/radicle-cli/src/commands/clone.rs @@ -18,7 +18,7 @@ use radicle::storage; use radicle::storage::git::Storage; use crate::commands::rad_checkout as checkout; -use crate::commands::rad_fetch as fetch; +use crate::commands::rad_sync as sync; use crate::project; use crate::terminal as term; use crate::terminal::args::{Args, Error, Help}; @@ -176,7 +176,7 @@ pub fn clone( ); } - let results = fetch::fetch(id, node)?; + let results = sync::fetch_all(id, node)?; let Ok(repository) = storage.repository(id) else { // If we don't have the project locally, even after attempting to fetch, // there's nothing we can do. diff --git a/radicle-cli/src/commands/fetch.rs b/radicle-cli/src/commands/fetch.rs deleted file mode 100644 index 2e124950..00000000 --- a/radicle-cli/src/commands/fetch.rs +++ /dev/null @@ -1,143 +0,0 @@ -#![allow(clippy::or_fun_call)] -use std::ffi::OsString; -use std::path::Path; - -use anyhow::{anyhow, Context}; - -use radicle::identity::doc::Id; -use radicle::node; -use radicle::node::{FetchResult, FetchResults, Handle as _, Node}; -use radicle::prelude::*; - -use crate::terminal as term; -use crate::terminal::args::{Args, Error, Help}; - -pub const HELP: Help = Help { - name: "fetch", - description: "Fetch repository refs from the network", - version: env!("CARGO_PKG_VERSION"), - usage: r#" -Usage - - rad fetch [