mirror of
https://github.com/rust-lang/cargo
synced 2024-10-06 15:59:39 +00:00
Updating based on code review
This commit is contained in:
parent
ec5f78f933
commit
3ed34979a7
|
@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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)"));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue