Skip to content

Commit

Permalink
Auto merge of #5990 - dwijnand:no-crates.io-index-url, r=alexcrichton
Browse files Browse the repository at this point in the history
Don't print crates.io-index URL when Updating

Following the lead from PackageId's Display, only display the registry's
URL if it's not the default registry (aka crates.io).

Before:

    $ cargo install lazy_static
        Updating registry `https://github.com/rust-lang/crates.io-index`

After:

    $ dcargo install lazy_static
        Updating crates.io index

Fixes #4208
  • Loading branch information
bors committed Sep 9, 2018
2 parents 41f98f3 + 41aa6fb commit 5984312
Show file tree
Hide file tree
Showing 22 changed files with 103 additions and 99 deletions.
6 changes: 5 additions & 1 deletion src/cargo/core/source/source_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ impl SourceId {
}

pub fn display_registry(&self) -> String {
format!("registry `{}`", self.url())
if self.is_default_registry() {
"crates.io index".to_string()
} else {
format!("`{}` index", self.url())
}
}

/// Is this source from a filesystem path
Expand Down
2 changes: 1 addition & 1 deletion src/doc/src/guide/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ their dependencies, compile them all, and update the `Cargo.lock`:

```console
$ cargo build
Updating registry `https://github.com/rust-lang/crates.io-index`
Updating crates.io index
Downloading memchr v0.1.5
Downloading libc v0.1.10
Downloading regex-syntax v0.2.1
Expand Down
14 changes: 7 additions & 7 deletions tests/testsuite/alt_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn depend_on_alt_registry() {
.masquerade_as_nightly_cargo()
.with_stderr(&format!(
"\
[UPDATING] registry `{reg}`
[UPDATING] `{reg}` index
[DOWNLOADING] bar v0.0.1 (registry `file://[..]`)
[COMPILING] bar v0.0.1 (registry `file://[..]`)
[COMPILING] foo v0.0.1 (CWD)
Expand Down Expand Up @@ -109,7 +109,7 @@ fn depend_on_alt_registry_depends_on_same_registry_no_index() {
.masquerade_as_nightly_cargo()
.with_stderr(&format!(
"\
[UPDATING] registry `{reg}`
[UPDATING] `{reg}` index
[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`)
[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`)
[COMPILING] baz v0.0.1 (registry `file://[..]`)
Expand Down Expand Up @@ -151,7 +151,7 @@ fn depend_on_alt_registry_depends_on_same_registry() {
.masquerade_as_nightly_cargo()
.with_stderr(&format!(
"\
[UPDATING] registry `{reg}`
[UPDATING] `{reg}` index
[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`)
[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`)
[COMPILING] baz v0.0.1 (registry `file://[..]`)
Expand Down Expand Up @@ -193,8 +193,8 @@ fn depend_on_alt_registry_depends_on_crates_io() {
.masquerade_as_nightly_cargo()
.with_stderr(&format!(
"\
[UPDATING] registry `{alt_reg}`
[UPDATING] registry `{reg}`
[UPDATING] `{alt_reg}` index
[UPDATING] `{reg}` index
[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`)
[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`)
[COMPILING] baz v0.0.1 (registry `file://[..]`)
Expand Down Expand Up @@ -358,9 +358,9 @@ fn alt_registry_and_crates_io_deps() {
p.cargo("build")
.masquerade_as_nightly_cargo()
.with_stderr_contains(format!(
"[UPDATING] registry `{}`",
"[UPDATING] `{}` index",
registry::alt_registry()
)).with_stderr_contains(&format!("[UPDATING] registry `{}`", registry::registry()))
)).with_stderr_contains(&format!("[UPDATING] `{}` index", registry::registry()))
.with_stderr_contains("[DOWNLOADING] crates_io_dep v0.0.1 (registry `file://[..]`)")
.with_stderr_contains("[DOWNLOADING] alt_reg_dep v0.1.0 (registry `file://[..]`)")
.with_stderr_contains("[COMPILING] alt_reg_dep v0.1.0 (registry `file://[..]`)")
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3551,7 +3551,7 @@ fn build_all_member_dependency_same_name() {

p.cargo("build --all")
.with_stderr(
"[..] Updating registry `[..]`\n\
"[..] Updating `[..]` index\n\
[..] Downloading a v0.1.0 ([..])\n\
[..] Compiling a v0.1.0\n\
[..] Compiling a v0.1.0 ([..])\n\
Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/build_script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2706,7 +2706,7 @@ fn warnings_hidden_for_upstream() {
p.cargo("build -v")
.with_stderr(
"\
[UPDATING] registry `[..]`
[UPDATING] `[..]` index
[DOWNLOADING] bar v0.1.0 ([..])
[COMPILING] bar v0.1.0
[RUNNING] `rustc [..]`
Expand Down Expand Up @@ -2760,7 +2760,7 @@ fn warnings_printed_on_vv() {
p.cargo("build -vv")
.with_stderr(
"\
[UPDATING] registry `[..]`
[UPDATING] `[..]` index
[DOWNLOADING] bar v0.1.0 ([..])
[COMPILING] bar v0.1.0
[RUNNING] `rustc [..]`
Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ fn works_through_the_registry() {
p.cargo("build")
.with_stderr(
"\
[UPDATING] registry [..]
[UPDATING] [..] index
[DOWNLOADING] [..]
[DOWNLOADING] [..]
[COMPILING] baz v0.1.0
Expand Down Expand Up @@ -266,7 +266,7 @@ fn ignore_version_from_other_platform() {
p.cargo("build")
.with_stderr(
"\
[UPDATING] registry [..]
[UPDATING] [..] index
[DOWNLOADING] [..]
[COMPILING] bar v0.1.0
[COMPILING] foo v0.0.1 ([..])
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/cross_publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ fn publish_with_target() {
.arg("--target")
.arg(&target)
.with_stderr(&format!(
" Updating registry `{registry}`
" Updating `{registry}` index
Packaging foo v0.0.0 (CWD)
Verifying foo v0.0.0 (CWD)
Compiling foo v0.0.0 (CWD/target/package/foo-0.0.0)
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ fn crates_io_then_directory() {
p.cargo("build")
.with_stderr(
"\
[UPDATING] registry `[..]`
[UPDATING] `[..]` index
[DOWNLOADING] bar v0.1.0 ([..])
[COMPILING] bar v0.1.0
[COMPILING] foo v0.1.0 (CWD)
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ fn doc_all_member_dependency_same_name() {
Package::new("bar", "0.1.0").publish();

p.cargo("doc --all")
.with_stderr_contains("[..] Updating registry `[..]`")
.with_stderr_contains("[..] Updating `[..]` index")
.with_stderr_contains("[..] Documenting bar v0.1.0 ([..])")
.run();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/generate_lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ fn no_index_update() {
.build();

p.cargo("generate-lockfile")
.with_stderr("[UPDATING] registry `[..]`")
.with_stderr("[UPDATING] `[..]` index")
.run();

p.cargo("generate-lockfile -Zno-index-update")
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2358,7 +2358,7 @@ fn include_overrides_gitignore() {
p.cargo("build -v")
.with_stderr(
"\
[UPDATING] registry `[..]`
[UPDATING] `[..]` index
[DOWNLOADING] filetime [..]
[DOWNLOADING] libc [..]
[COMPILING] libc [..]
Expand Down
10 changes: 5 additions & 5 deletions tests/testsuite/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn simple() {
cargo_process("install foo")
.with_stderr(
"\
[UPDATING] registry `[..]`
[UPDATING] `[..]` index
[DOWNLOADING] foo v0.0.1 (registry [..])
[INSTALLING] foo v0.0.1
[COMPILING] foo v0.0.1
Expand All @@ -52,7 +52,7 @@ fn multiple_pkgs() {
.with_status(101)
.with_stderr(
"\
[UPDATING] registry `[..]`
[UPDATING] `[..]` index
[DOWNLOADING] foo v0.0.1 (registry `CWD/registry`)
[INSTALLING] foo v0.0.1
[COMPILING] foo v0.0.1
Expand Down Expand Up @@ -96,7 +96,7 @@ fn pick_max_version() {
cargo_process("install foo")
.with_stderr(
"\
[UPDATING] registry `[..]`
[UPDATING] `[..]` index
[DOWNLOADING] foo v0.2.1 (registry [..])
[INSTALLING] foo v0.2.1
[COMPILING] foo v0.2.1
Expand Down Expand Up @@ -129,7 +129,7 @@ fn missing() {
.with_status(101)
.with_stderr(
"\
[UPDATING] registry [..]
[UPDATING] [..] index
[ERROR] could not find `bar` in registry `[..]`
",
).run();
Expand All @@ -142,7 +142,7 @@ fn bad_version() {
.with_status(101)
.with_stderr(
"\
[UPDATING] registry [..]
[UPDATING] [..] index
[ERROR] could not find `foo` in registry `[..]` with version `=0.2.0`
",
).run();
Expand Down
6 changes: 3 additions & 3 deletions tests/testsuite/lockfile_compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
.with_status(101)
.with_stderr(
"\
[UPDATING] registry `[..]`
[UPDATING] `[..]` index
error: checksum for `bar v0.1.0` changed between lock files
this could be indicative of a few possible errors:
Expand Down Expand Up @@ -284,7 +284,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
.with_status(101)
.with_stderr(
"\
[UPDATING] registry `[..]`
[UPDATING] `[..]` index
error: checksum for `bar v0.1.0` was not previously calculated, but a checksum \
could now be calculated
Expand Down Expand Up @@ -479,7 +479,7 @@ fn locked_correct_error() {
.with_status(101)
.with_stderr(
"\
[UPDATING] registry `[..]`
[UPDATING] `[..]` index
error: the lock file needs to be updated but --locked was passed to prevent this
",
).run();
Expand Down
26 changes: 13 additions & 13 deletions tests/testsuite/overrides.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn override_simple() {
p.cargo("build")
.with_stderr(
"\
[UPDATING] registry `file://[..]`
[UPDATING] `file://[..]` index
[UPDATING] git repository `[..]`
[COMPILING] bar v0.1.0 (file://[..])
[COMPILING] foo v0.0.1 (CWD)
Expand Down Expand Up @@ -183,7 +183,7 @@ fn transitive() {
p.cargo("build")
.with_stderr(
"\
[UPDATING] registry `file://[..]`
[UPDATING] `file://[..]` index
[UPDATING] git repository `[..]`
[DOWNLOADING] baz v0.2.0 (registry [..])
[COMPILING] bar v0.1.0 (file://[..])
Expand Down Expand Up @@ -231,7 +231,7 @@ fn persists_across_rebuilds() {
p.cargo("build")
.with_stderr(
"\
[UPDATING] registry `file://[..]`
[UPDATING] `file://[..]` index
[UPDATING] git repository `file://[..]`
[COMPILING] bar v0.1.0 (file://[..])
[COMPILING] foo v0.0.1 (CWD)
Expand Down Expand Up @@ -275,7 +275,7 @@ fn replace_registry_with_path() {
p.cargo("build")
.with_stderr(
"\
[UPDATING] registry `file://[..]`
[UPDATING] `file://[..]` index
[COMPILING] bar v0.1.0 (file://[..])
[COMPILING] foo v0.0.1 (CWD)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
Expand Down Expand Up @@ -336,7 +336,7 @@ fn use_a_spec_to_select() {
p.cargo("build")
.with_stderr(
"\
[UPDATING] registry `file://[..]`
[UPDATING] `file://[..]` index
[UPDATING] git repository `[..]`
[DOWNLOADING] [..]
[DOWNLOADING] [..]
Expand Down Expand Up @@ -393,7 +393,7 @@ fn override_adds_some_deps() {
p.cargo("build")
.with_stderr(
"\
[UPDATING] registry `file://[..]`
[UPDATING] `file://[..]` index
[UPDATING] git repository `[..]`
[DOWNLOADING] baz v0.1.1 (registry [..])
[COMPILING] baz v0.1.1
Expand All @@ -411,13 +411,13 @@ fn override_adds_some_deps() {
.with_stderr(
"\
[UPDATING] git repository `file://[..]`
[UPDATING] registry `file://[..]`
[UPDATING] `file://[..]` index
",
).run();
p.cargo("update -p https://github.com/rust-lang/crates.io-index#bar")
.with_stderr(
"\
[UPDATING] registry `file://[..]`
[UPDATING] `file://[..]` index
",
).run();

Expand Down Expand Up @@ -508,7 +508,7 @@ fn override_wrong_name() {
.with_status(101)
.with_stderr(
"\
[UPDATING] registry [..]
[UPDATING] [..] index
[UPDATING] git repository [..]
error: no matching package for override `[..]baz:0.1.0` found
location searched: file://[..]
Expand Down Expand Up @@ -550,7 +550,7 @@ fn override_with_nothing() {
.with_status(101)
.with_stderr(
"\
[UPDATING] registry [..]
[UPDATING] [..] index
[UPDATING] git repository [..]
[ERROR] failed to load source for a dependency on `bar`
Expand Down Expand Up @@ -629,7 +629,7 @@ fn multiple_specs() {
.with_status(101)
.with_stderr(
"\
[UPDATING] registry [..]
[UPDATING] [..] index
[UPDATING] git repository [..]
error: overlapping replacement specifications found:
Expand Down Expand Up @@ -717,7 +717,7 @@ fn update() {
p.cargo("update")
.with_stderr(
"\
[UPDATING] registry `[..]`
[UPDATING] `[..]` index
[UPDATING] git repository `[..]`
",
).run();
Expand Down Expand Up @@ -1039,7 +1039,7 @@ fn no_warnings_when_replace_is_used_in_another_workspace_member() {
.with_stdout("")
.with_stderr(
"\
[UPDATING] registry `[..]`
[UPDATING] `[..]` index
[COMPILING] bar v0.1.0 ([..])
[COMPILING] first_crate v0.1.0 ([..])
[FINISHED] [..]",
Expand Down
Loading

0 comments on commit 5984312

Please sign in to comment.