diff --git a/src/bin/cargo/commands/update.rs b/src/bin/cargo/commands/update.rs index d72c19cd2669..1749de763a7c 100644 --- a/src/bin/cargo/commands/update.rs +++ b/src/bin/cargo/commands/update.rs @@ -24,9 +24,10 @@ pub fn cli() -> Command { .arg_dry_run("Don't actually write the lockfile") .arg( flag( - "aggressive", + "recursive", "Force updating all dependencies of [SPEC]... as well", ) + .alias("aggressive") .conflicts_with("precise"), ) .arg( @@ -68,7 +69,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult { } let update_opts = UpdateOptions { - aggressive: args.flag("aggressive"), + recursive: args.flag("recursive"), precise: args.get_one::("precise").map(String::as_str), to_update, dry_run: args.dry_run(), diff --git a/src/cargo/ops/cargo_generate_lockfile.rs b/src/cargo/ops/cargo_generate_lockfile.rs index 2bcdcbefd986..265d2a883d46 100644 --- a/src/cargo/ops/cargo_generate_lockfile.rs +++ b/src/cargo/ops/cargo_generate_lockfile.rs @@ -14,7 +14,7 @@ pub struct UpdateOptions<'a> { pub config: &'a Config, pub to_update: Vec, pub precise: Option<&'a str>, - pub aggressive: bool, + pub recursive: bool, pub dry_run: bool, pub workspace: bool, } @@ -38,8 +38,8 @@ pub fn generate_lockfile(ws: &Workspace<'_>) -> CargoResult<()> { } pub fn update_lockfile(ws: &Workspace<'_>, opts: &UpdateOptions<'_>) -> CargoResult<()> { - if opts.aggressive && opts.precise.is_some() { - anyhow::bail!("cannot specify both aggressive and precise simultaneously") + if opts.recursive && opts.precise.is_some() { + anyhow::bail!("cannot specify both recursive and precise simultaneously") } if ws.members().count() == 0 { @@ -89,7 +89,7 @@ pub fn update_lockfile(ws: &Workspace<'_>, opts: &UpdateOptions<'_>) -> CargoRes let mut sources = Vec::new(); for name in opts.to_update.iter() { let dep = previous_resolve.query(name)?; - if opts.aggressive { + if opts.recursive { fill_with_deps(&previous_resolve, dep, &mut to_avoid, &mut HashSet::new()); } else { to_avoid.insert(dep); diff --git a/src/doc/man/cargo-update.md b/src/doc/man/cargo-update.md index a24330fad4f5..b392b83145f7 100644 --- a/src/doc/man/cargo-update.md +++ b/src/doc/man/cargo-update.md @@ -33,7 +33,7 @@ will remain locked at their currently recorded versions. If _spec_ is not specified, all dependencies are updated. {{/option}} -{{#option "`--aggressive`" }} +{{#option "`--recursive`" }} When used with _spec_, dependencies of _spec_ are forced to update as well. Cannot be used with `--precise`. {{/option}} diff --git a/src/doc/man/generated_txt/cargo-update.txt b/src/doc/man/generated_txt/cargo-update.txt index c7554c197f12..a96a34c962e8 100644 --- a/src/doc/man/generated_txt/cargo-update.txt +++ b/src/doc/man/generated_txt/cargo-update.txt @@ -26,7 +26,7 @@ OPTIONS If spec is not specified, all dependencies are updated. - --aggressive + --recursive When used with spec, dependencies of spec are forced to update as well. Cannot be used with --precise. diff --git a/src/doc/src/commands/cargo-update.md b/src/doc/src/commands/cargo-update.md index e08f6f91fed8..234998faa5e0 100644 --- a/src/doc/src/commands/cargo-update.md +++ b/src/doc/src/commands/cargo-update.md @@ -31,7 +31,7 @@ will remain locked at their currently recorded versions.

If spec is not specified, all dependencies are updated. -

--aggressive
+
--recursive
When used with spec, dependencies of spec are forced to update as well. Cannot be used with --precise.
diff --git a/src/doc/src/reference/resolver.md b/src/doc/src/reference/resolver.md index 49beb5d60afc..7d01fb167add 100644 --- a/src/doc/src/reference/resolver.md +++ b/src/doc/src/reference/resolver.md @@ -342,7 +342,7 @@ instead. [`cargo update`] can be used to update the entries in `Cargo.lock` when new versions are published. Without any options, it will attempt to update all packages in the lock file. The `-p` flag can be used to target the update for -a specific package, and other flags such as `--aggressive` or `--precise` can +a specific package, and other flags such as `--recursive` or `--precise` can be used to control how versions are selected. [`cargo build`]: ../commands/cargo-build.md diff --git a/src/etc/_cargo b/src/etc/_cargo index a017b51c552f..8df59b5f380d 100644 --- a/src/etc/_cargo +++ b/src/etc/_cargo @@ -342,6 +342,7 @@ _cargo() { update) _arguments -s -S $common $manifest \ '--aggressive=[force dependency update]' \ + '--recursive=[force dependency update]' \ "--dry-run[don't actually write the lockfile]" \ '(-p --package)'{-p+,--package=}'[specify package to update]:package:_cargo_package_names' \ '--precise=[update single dependency to precise release]:release' \ diff --git a/src/etc/cargo.bashcomp.sh b/src/etc/cargo.bashcomp.sh index 33f225ebf395..23f22595b17d 100644 --- a/src/etc/cargo.bashcomp.sh +++ b/src/etc/cargo.bashcomp.sh @@ -87,7 +87,7 @@ _cargo() local opt__t="$opt__test" local opt__tree="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock --target -i --invert --prefix --no-dedupe --duplicates -d --charset -f --format -e --edges" local opt__uninstall="$opt_common $opt_lock $opt_pkg --bin --root" - local opt__update="$opt_common $opt_mani $opt_lock $opt_pkg --aggressive --precise --dry-run" + local opt__update="$opt_common $opt_mani $opt_lock $opt_pkg --aggressive --recursive --precise --dry-run" local opt__vendor="$opt_common $opt_mani $opt_lock $opt_sync --no-delete --respect-source-config --versioned-dirs" local opt__verify_project="$opt_common $opt_mani $opt_lock" local opt__version="$opt_common $opt_lock" diff --git a/src/etc/man/cargo-update.1 b/src/etc/man/cargo-update.1 index 0ea8db3a8815..c9fe881c8fc6 100644 --- a/src/etc/man/cargo-update.1 +++ b/src/etc/man/cargo-update.1 @@ -28,7 +28,7 @@ will remain locked at their currently recorded versions. If \fIspec\fR is not specified, all dependencies are updated. .RE .sp -\fB\-\-aggressive\fR +\fB\-\-recursive\fR .RS 4 When used with \fIspec\fR, dependencies of \fIspec\fR are forced to update as well. Cannot be used with \fB\-\-precise\fR\&. diff --git a/tests/testsuite/cargo_update/help/stdout.log b/tests/testsuite/cargo_update/help/stdout.log index dec044f4b7b4..111ee72d4fc4 100644 --- a/tests/testsuite/cargo_update/help/stdout.log +++ b/tests/testsuite/cargo_update/help/stdout.log @@ -4,7 +4,7 @@ Usage: cargo[EXE] update [OPTIONS] [SPEC]... Options: --dry-run Don't actually write the lockfile - --aggressive Force updating all dependencies of [SPEC]... as well + --recursive Force updating all dependencies of [SPEC]... as well --precise Update [SPEC] to exactly PRECISE -q, --quiet Do not print cargo log messages -v, --verbose... Use verbose output (-vv very verbose/build.rs output) diff --git a/tests/testsuite/git.rs b/tests/testsuite/git.rs index b47b3986722b..7ed9b546cdeb 100644 --- a/tests/testsuite/git.rs +++ b/tests/testsuite/git.rs @@ -769,9 +769,9 @@ Caused by: .with_stdout("") .run(); - // Updating aggressively should, however, update the repo. - println!("dep1 aggressive update"); - p.cargo("update dep1 --aggressive") + // Updating recursively should, however, update the repo. + println!("dep1 recursive update"); + p.cargo("update dep1 --recursive") .with_stderr(&format!( "[UPDATING] git repository `{}`\n\ [UPDATING] bar v0.5.0 ([..]) -> #[..]\n\ diff --git a/tests/testsuite/update.rs b/tests/testsuite/update.rs index d7d008b23933..4f73f7f8c56d 100644 --- a/tests/testsuite/update.rs +++ b/tests/testsuite/update.rs @@ -428,7 +428,7 @@ fn update_precise_do_not_force_update_deps() { } #[cargo_test] -fn update_aggressive() { +fn update_recursive() { Package::new("log", "0.1.0").publish(); Package::new("serde", "0.2.1").dep("log", "0.1").publish(); @@ -453,7 +453,7 @@ fn update_aggressive() { Package::new("log", "0.1.1").publish(); Package::new("serde", "0.2.2").dep("log", "0.1").publish(); - p.cargo("update serde:0.2.1 --aggressive") + p.cargo("update serde:0.2.1 --recursive") .with_stderr( "\ [UPDATING] `[..]` index @@ -465,7 +465,7 @@ fn update_aggressive() { } #[cargo_test] -fn update_aggressive_conflicts_with_precise() { +fn update_recursive_conflicts_with_precise() { Package::new("log", "0.1.0").publish(); Package::new("serde", "0.2.1").dep("log", "0.1").publish(); @@ -490,11 +490,11 @@ fn update_aggressive_conflicts_with_precise() { Package::new("log", "0.1.1").publish(); Package::new("serde", "0.2.2").dep("log", "0.1").publish(); - p.cargo("update serde:0.2.1 --precise 0.2.2 --aggressive") + p.cargo("update serde:0.2.1 --precise 0.2.2 --recursive") .with_status(1) .with_stderr( "\ -error: the argument '--precise ' cannot be used with '--aggressive' +error: the argument '--precise ' cannot be used with '--recursive' Usage: cargo[EXE] update --precise ]>