Skip to content

Commit

Permalink
Auto merge of #3588 - birkenfeld:issue3587, r=alexcrichton
Browse files Browse the repository at this point in the history
Show new version of package on overwrite error

Fixes #3587
  • Loading branch information
bors committed Jan 25, 2017
2 parents 69f03dc + 82a8f6f commit 67e4ef1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/cargo/ops/cargo_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ pub fn install(root: Option<&str>,
};
let pkg = ws.current()?;

config.shell().status("Installing", pkg)?;

// Preflight checks to check up front whether we'll overwrite something.
// We have to check this again afterwards, but may as well avoid building
// anything if we're gonna throw it away anyway.
Expand Down
12 changes: 11 additions & 1 deletion tests/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ fn simple() {
execs().with_status(0).with_stderr(&format!("\
[UPDATING] registry `[..]`
[DOWNLOADING] foo v0.0.1 (registry [..])
[INSTALLING] foo v0.0.1
[COMPILING] foo v0.0.1
[FINISHED] release [optimized] target(s) in [..]
[INSTALLING] {home}[..]bin[..]foo[..]
Expand All @@ -62,6 +63,7 @@ fn pick_max_version() {
execs().with_status(0).with_stderr(&format!("\
[UPDATING] registry `[..]`
[DOWNLOADING] foo v0.0.2 (registry [..])
[INSTALLING] foo v0.0.2
[COMPILING] foo v0.0.2
[FINISHED] release [optimized] target(s) in [..]
[INSTALLING] {home}[..]bin[..]foo[..]
Expand Down Expand Up @@ -171,6 +173,7 @@ fn install_path() {
assert_that(cargo_home(), has_installed_exe("foo"));
assert_that(cargo_process("install").arg("--path").arg(".").cwd(p.root()),
execs().with_status(101).with_stderr("\
[INSTALLING] foo v0.1.0 [..]
[ERROR] binary `foo[..]` already exists in destination as part of `foo v0.1.0 [..]`
Add --force to overwrite
"));
Expand Down Expand Up @@ -336,6 +339,7 @@ fn no_binaries() {

assert_that(cargo_process("install").arg("--path").arg(p.root()).arg("foo"),
execs().with_status(101).with_stderr("\
[INSTALLING] foo [..]
[ERROR] specified package has no binaries
"));
}
Expand Down Expand Up @@ -376,6 +380,7 @@ fn install_twice() {
execs().with_status(0));
assert_that(cargo_process("install").arg("--path").arg(p.root()),
execs().with_status(101).with_stderr("\
[INSTALLING] foo v0.1.0 [..]
[ERROR] binary `foo-bin1[..]` already exists in destination as part of `foo v0.1.0 ([..])`
binary `foo-bin2[..]` already exists in destination as part of `foo v0.1.0 ([..])`
Add --force to overwrite
Expand Down Expand Up @@ -409,6 +414,7 @@ fn install_force() {

assert_that(cargo_process("install").arg("--force").arg("--path").arg(p.root()),
execs().with_status(0).with_stderr(&format!("\
[INSTALLING] foo v0.2.0 ([..])
[COMPILING] foo v0.2.0 ([..])
[FINISHED] release [optimized] target(s) in [..]
[REPLACING] {home}[..]bin[..]foo[..]
Expand Down Expand Up @@ -452,6 +458,7 @@ fn install_force_partial_overlap() {

assert_that(cargo_process("install").arg("--force").arg("--path").arg(p.root()),
execs().with_status(0).with_stderr(&format!("\
[INSTALLING] foo v0.2.0 ([..])
[COMPILING] foo v0.2.0 ([..])
[FINISHED] release [optimized] target(s) in [..]
[INSTALLING] {home}[..]bin[..]foo-bin3[..]
Expand Down Expand Up @@ -503,6 +510,7 @@ fn install_force_bin() {
.arg("--path")
.arg(p.root()),
execs().with_status(0).with_stderr(&format!("\
[INSTALLING] foo v0.2.0 ([..])
[COMPILING] foo v0.2.0 ([..])
[FINISHED] release [optimized] target(s) in [..]
[REPLACING] {home}[..]bin[..]foo-bin2[..]
Expand Down Expand Up @@ -559,6 +567,7 @@ fn git_repo() {
assert_that(cargo_process("install").arg("--locked").arg("--git").arg(p.url().to_string()),
execs().with_status(0).with_stderr(&format!("\
[UPDATING] git repository `[..]`
[INSTALLING] foo v0.1.0 ([..])
[COMPILING] foo v0.1.0 ([..])
[FINISHED] release [optimized] target(s) in [..]
[INSTALLING] {home}[..]bin[..]foo[..]
Expand Down Expand Up @@ -697,7 +706,8 @@ fn do_not_rebuilds_on_local_install() {
assert_that(p.cargo_process("build").arg("--release"),
execs().with_status(0));
assert_that(cargo_process("install").arg("--path").arg(p.root()),
execs().with_status(0).with_stderr("[FINISHED] release [optimized] target(s) in [..]
execs().with_status(0).with_stderr("[INSTALLING] [..]
[FINISHED] release [optimized] target(s) in [..]
[INSTALLING] [..]
warning: be sure to add `[..]` to your PATH to be able to run the installed binaries
"));
Expand Down

0 comments on commit 67e4ef1

Please sign in to comment.