From: Pelepeichenko Alexander Date: Mon, 8 Jan 2018 18:22:12 +0000 (+0200) Subject: Updating based on code review X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~3^2~46^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3ed34979a7036c62e2227b43ad3a8117d04fc69f;p=cargo.git Updating based on code review --- diff --git a/src/cargo/core/resolver/mod.rs b/src/cargo/core/resolver/mod.rs index e59c73599..02a26a9f7 100644 --- a/src/cargo/core/resolver/mod.rs +++ b/src/cargo/core/resolver/mod.rs @@ -889,8 +889,10 @@ fn activation_error(cx: &Context, if let Some(config) = config { if config.cli_unstable().offline { - msg.push_str("\nperhaps an error occurred because you are using \ - the offline mode"); + msg.push_str("\nAs a reminder, you're using offline mode (-Z offline) \ + which can sometimes cause surprising resolution failures, \ + if this error is too confusing you may with to retry \ + without the offline flag."); } } diff --git a/src/cargo/sources/git/source.rs b/src/cargo/sources/git/source.rs index 3862266de..0ec9c1697 100644 --- a/src/cargo/sources/git/source.rs +++ b/src/cargo/sources/git/source.rs @@ -152,7 +152,8 @@ impl<'cfg> Source for GitSource<'cfg> { let db_path = lock.parent().join("db").join(&self.ident); if self.config.cli_unstable().offline && !db_path.exists() { - bail!("can't checkout from '{}': you are in the offline mode", self.remote.url()); + bail!("can't checkout from '{}': you are in the offline mode (-Z offline)", + self.remote.url()); } // Resolve our reference to an actual revision, and check if the diff --git a/tests/build.rs b/tests/build.rs index bf4348b85..1ca01cabf 100644 --- a/tests/build.rs +++ b/tests/build.rs @@ -897,13 +897,10 @@ fn cargo_compile_with_downloaded_dependency_with_offline() { assert_that(p2.cargo("build").masquerade_as_nightly_cargo().arg("-Zoffline"), execs().with_status(0) - .with_stderr_does_not_contain("Updating registry") - .with_stderr_does_not_contain("Downloading") .with_stderr(format!("\ [COMPILING] present_dep v1.2.3 -[COMPILING] bar v0.1.0 ({url}) -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]", - url = p2.url()))); +[COMPILING] bar v0.1.0 ([..]) +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]"))); } @@ -923,13 +920,14 @@ fn cargo_compile_offline_not_try_update() { assert_that(p.cargo("build").masquerade_as_nightly_cargo().arg("-Zoffline"), execs().with_status(101) - .with_stderr_does_not_contain("Updating registry") - .with_stderr_does_not_contain("Downloading") .with_stderr("\ error: no matching package named `not_cached_dep` found (required by `bar`) location searched: registry `[..]` version required: ^1.2.5 -perhaps an error occurred because you are using the offline mode")); +As a reminder, you're using offline mode (-Z offline) \ +which can sometimes cause surprising resolution failures, \ +if this error is too confusing you may with to retry \ +without the offline flag.")); } #[test] @@ -987,16 +985,15 @@ fn main(){ }") .build(); - assert_that(p2.cargo("build").masquerade_as_nightly_cargo().arg("-Zoffline"), + assert_that(p2.cargo("run").masquerade_as_nightly_cargo().arg("-Zoffline"), execs().with_status(0) .with_stderr(format!("\ [COMPILING] present_dep v1.2.3 [COMPILING] foo v0.1.0 ({url}) -[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]", - url = p2.url()))); - - assert_that(process(&p2.bin("foo")), - execs().with_status(0).with_stdout("1.2.3")); +[FINISHED] dev [unoptimized + debuginfo] target(s) in [..] + Running `[..]`", url = p2.url())) + .with_stdout("1.2.3") + ); } #[test] @@ -1033,13 +1030,14 @@ fn compile_offline_while_transitive_dep_not_cached() { assert_that(p.cargo("build").masquerade_as_nightly_cargo().arg("-Zoffline"), execs().with_status(101) - .with_stderr_does_not_contain("Updating registry") - .with_stderr_does_not_contain("Downloading") .with_stderr("\ error: no matching package named `bar` found (required by `foo`) location searched: registry `[..]` version required: = 1.0.0 -perhaps an error occurred because you are using the offline mode")); +As a reminder, you're using offline mode (-Z offline) \ +which can sometimes cause surprising resolution failures, \ +if this error is too confusing you may with to retry \ +without the offline flag.")); } #[test] diff --git a/tests/git.rs b/tests/git.rs index 8c9edf75f..a6ccfcdf1 100644 --- a/tests/git.rs +++ b/tests/git.rs @@ -97,7 +97,6 @@ fn cargo_compile_forbird_git_httpsrepo_offline() { assert_that(p.cargo("build").masquerade_as_nightly_cargo().arg("-Zoffline"), execs().with_status(101). - with_stderr_does_not_contain("[UPDATING] git repository [..]"). with_stderr("\ error: failed to load source for a dependency on `dep1` @@ -105,7 +104,7 @@ Caused by: Unable to update https://github.com/some_user/dep1.git Caused by: - can't checkout from 'https://github.com/some_user/dep1.git': you are in the offline mode")); + can't checkout from 'https://github.com/some_user/dep1.git': you are in the offline mode (-Z offline)")); }