From 7ac399556872367bd813ff0a4b697632183506d1 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 25 Mar 2020 15:23:53 -0700 Subject: [PATCH] Remove the `git-checkout` subcommand. --- src/bin/cargo/commands/git_checkout.rs | 35 +++++--------------------- src/etc/_cargo | 6 ----- src/etc/cargo.bashcomp.sh | 1 - 3 files changed, 6 insertions(+), 36 deletions(-) diff --git a/src/bin/cargo/commands/git_checkout.rs b/src/bin/cargo/commands/git_checkout.rs index ccabbb2ede8..aae435a5196 100644 --- a/src/bin/cargo/commands/git_checkout.rs +++ b/src/bin/cargo/commands/git_checkout.rs @@ -1,37 +1,14 @@ use crate::command_prelude::*; -use cargo::core::{GitReference, Source, SourceId}; -use cargo::sources::GitSource; -use cargo::util::IntoUrl; +const REMOVED: &str = "The `git-checkout` subcommand has been removed."; pub fn cli() -> App { subcommand("git-checkout") - .about("Checkout a copy of a Git repository") - .arg(opt("quiet", "No output printed to stdout").short("q")) - .arg( - Arg::with_name("url") - .long("url") - .value_name("URL") - .required(true), - ) - .arg( - Arg::with_name("reference") - .long("reference") - .value_name("REF") - .required(true), - ) + .about("This subcommand has been removed") + .settings(&[AppSettings::Hidden]) + .help(REMOVED) } -pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult { - let url = args.value_of("url").unwrap().into_url()?; - let reference = args.value_of("reference").unwrap(); - - let reference = GitReference::Branch(reference.to_string()); - let source_id = SourceId::for_git(&url, reference)?; - - let mut source = GitSource::new(source_id, config)?; - - source.update()?; - - Ok(()) +pub fn exec(_config: &mut Config, _args: &ArgMatches<'_>) -> CliResult { + Err(anyhow::format_err!(REMOVED).into()) } diff --git a/src/etc/_cargo b/src/etc/_cargo index 12694901ed0..864f15339ec 100644 --- a/src/etc/_cargo +++ b/src/etc/_cargo @@ -129,12 +129,6 @@ _cargo() { _arguments -s -S $common $manifest ;; - git-checkout) - _arguments -s -S $common \ - '--reference=:reference' \ - '--url=:url:_urls' - ;; - help) _cargo_cmds ;; diff --git a/src/etc/cargo.bashcomp.sh b/src/etc/cargo.bashcomp.sh index 7b0e9ed3e6a..0f423d98daa 100644 --- a/src/etc/cargo.bashcomp.sh +++ b/src/etc/cargo.bashcomp.sh @@ -56,7 +56,6 @@ _cargo() local opt__fetch="$opt_common $opt_mani $opt_lock --target" local opt__fix="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_jobs $opt_targets $opt_lock --release --target --message-format --broken-code --edition --edition-idioms --allow-no-vcs --allow-dirty --allow-staged --profile --target-dir" local opt__generate_lockfile="$opt_common $opt_mani $opt_lock" - local opt__git_checkout="$opt_common $opt_lock --reference --url" local opt__help="$opt_help" local opt__init="$opt_common $opt_lock --bin --lib --name --vcs --edition --registry" local opt__install="$opt_common $opt_feat $opt_jobs $opt_lock $opt_force --bin --bins --branch --debug --example --examples --git --list --path --rev --root --tag --version --registry --target --profile --no-track"