-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
6 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters