Skip to content

Commit

Permalink
fix: change --workspace based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
chaaz committed Nov 12, 2020
1 parent 40d71fb commit 42f3469
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/bin/cargo/commands/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub fn cli() -> App {
subcommand("update")
.about("Update dependencies as recorded in the local lock file")
.arg(opt("quiet", "No output printed to stdout").short("q"))
.arg(opt("workspace", "Only update the workspace pakcages").short("w"))
.arg(opt("workspace", "Only update the workspace packages").short("w"))
.arg_package_spec_simple("Package to update")
.arg(opt(
"aggressive",
Expand Down
19 changes: 4 additions & 15 deletions src/cargo/ops/cargo_generate_lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,6 @@ pub fn generate_lockfile(ws: &Workspace<'_>) -> CargoResult<()> {
}

pub fn update_lockfile(ws: &Workspace<'_>, opts: &UpdateOptions<'_>) -> CargoResult<()> {
if opts.workspace {
if opts.aggressive {
anyhow::bail!("cannot specify aggressive for workspace updates");
}
if opts.precise.is_some() {
anyhow::bail!("cannot specify precise for workspace updates");
}

ws.emit_warnings()?;
let (_packages, _resolve) = ops::resolve_ws(ws)?;
return Ok(());
}

if opts.aggressive && opts.precise.is_some() {
anyhow::bail!("cannot specify both aggressive and precise simultaneously")
}
Expand Down Expand Up @@ -92,8 +79,10 @@ pub fn update_lockfile(ws: &Workspace<'_>, opts: &UpdateOptions<'_>) -> CargoRes
let mut to_avoid = HashSet::new();

if opts.to_update.is_empty() {
to_avoid.extend(previous_resolve.iter());
to_avoid.extend(previous_resolve.unused_patches());
if !opts.workspace {
to_avoid.extend(previous_resolve.iter());
to_avoid.extend(previous_resolve.unused_patches());
}
} else {
let mut sources = Vec::new();
for name in opts.to_update.iter() {
Expand Down
1 change: 0 additions & 1 deletion src/doc/man/cargo-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Attempt to update only packages defined in the workspace. Other packages
are updated only if they don't already exist in the lockfile. This
option is useful for updating `Cargo.lock` after you've changed version
numbers in `Cargo.toml`.
Cannot be used with `--precise` or `--aggressive`.
{{/option}}

{{#option "`--dry-run`" }}
Expand Down
3 changes: 1 addition & 2 deletions src/doc/man/generated_txt/cargo-update.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ OPTIONS
Attempt to update only packages defined in the workspace. Other
packages are updated only if they don't already exist in the
lockfile. This option is useful for updating Cargo.lock after you've
changed version numbers in Cargo.toml. Cannot be used with --precise
or --aggressive.
changed version numbers in Cargo.toml.

--dry-run
Displays what would be updated, but doesn't actually write the
Expand Down
3 changes: 1 addition & 2 deletions src/doc/src/commands/cargo-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ revision (such as a SHA hash or tag).</dd>
<dd class="option-desc">Attempt to update only packages defined in the workspace. Other packages
are updated only if they don't already exist in the lockfile. This
option is useful for updating <code>Cargo.lock</code> after you've changed version
numbers in <code>Cargo.toml</code>.
Cannot be used with <code>--precise</code> or <code>--aggressive</code>.</dd>
numbers in <code>Cargo.toml</code>.</dd>


<dt class="option-term" id="option-cargo-update---dry-run"><a class="option-anchor" href="#option-cargo-update---dry-run"></a><code>--dry-run</code></dt>
Expand Down
1 change: 0 additions & 1 deletion src/etc/man/cargo-update.1
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Attempt to update only packages defined in the workspace. Other packages
are updated only if they don't already exist in the lockfile. This
option is useful for updating \fBCargo.lock\fR after you've changed version
numbers in \fBCargo.toml\fR\&.
Cannot be used with \fB\-\-precise\fR or \fB\-\-aggressive\fR\&.
.RE
.sp
\fB\-\-dry\-run\fR
Expand Down

0 comments on commit 42f3469

Please sign in to comment.