mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
fix(publish): Don't tell people to ctrl-c without knowing consequences
Fixes #15005
This commit is contained in:
parent
f0161607fb
commit
2e1f971c43
@ -272,11 +272,20 @@ pub fn publish(ws: &Workspace<'_>, opts: &PublishOpts<'_>) -> CargoResult<()> {
|
|||||||
if 0 < timeout {
|
if 0 < timeout {
|
||||||
let source_description = source.source_id().to_string();
|
let source_description = source.source_id().to_string();
|
||||||
let short_pkg_descriptions = package_list(to_confirm.iter().copied(), "or");
|
let short_pkg_descriptions = package_list(to_confirm.iter().copied(), "or");
|
||||||
opts.gctx.shell().note(format!(
|
if plan.is_empty() {
|
||||||
|
opts.gctx.shell().note(format!(
|
||||||
"waiting for {short_pkg_descriptions} to be available at {source_description}.\n\
|
"waiting for {short_pkg_descriptions} to be available at {source_description}.\n\
|
||||||
You may press ctrl-c to skip waiting; the {crate} should be available shortly.",
|
You may press ctrl-c to skip waiting; the {crate} should be available shortly.",
|
||||||
crate = if to_confirm.len() == 1 { "crate" } else {"crates"}
|
crate = if to_confirm.len() == 1 { "crate" } else {"crates"}
|
||||||
))?;
|
))?;
|
||||||
|
} else {
|
||||||
|
opts.gctx.shell().note(format!(
|
||||||
|
"waiting for {short_pkg_descriptions} to be available at {source_description}.\n\
|
||||||
|
{count} remaining {crate} to be published",
|
||||||
|
count = plan.len(),
|
||||||
|
crate = if plan.len() == 1 { "crate" } else {"crates"}
|
||||||
|
))?;
|
||||||
|
}
|
||||||
|
|
||||||
let timeout = Duration::from_secs(timeout);
|
let timeout = Duration::from_secs(timeout);
|
||||||
let confirmed = wait_for_any_publish_confirmation(
|
let confirmed = wait_for_any_publish_confirmation(
|
||||||
@ -696,6 +705,10 @@ impl PublishPlan {
|
|||||||
self.dependencies_count.is_empty()
|
self.dependencies_count.is_empty()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn len(&self) -> usize {
|
||||||
|
self.dependencies_count.len()
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the set of packages that are ready for publishing (i.e. have no outstanding dependencies).
|
/// Returns the set of packages that are ready for publishing (i.e. have no outstanding dependencies).
|
||||||
///
|
///
|
||||||
/// These will not be returned in future calls.
|
/// These will not be returned in future calls.
|
||||||
|
@ -3388,7 +3388,7 @@ See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for
|
|||||||
[UPLOADING] dep v0.0.1 ([ROOT]/foo/dep)
|
[UPLOADING] dep v0.0.1 ([ROOT]/foo/dep)
|
||||||
[UPLOADED] dep v0.0.1 to registry `crates-io`
|
[UPLOADED] dep v0.0.1 to registry `crates-io`
|
||||||
[NOTE] waiting for dep v0.0.1 to be available at registry `crates-io`.
|
[NOTE] waiting for dep v0.0.1 to be available at registry `crates-io`.
|
||||||
You may press ctrl-c to skip waiting; the crate should be available shortly.
|
2 remaining crates to be published
|
||||||
[WARNING] timed out waiting for dep v0.0.1 to be available in registry `crates-io`
|
[WARNING] timed out waiting for dep v0.0.1 to be available in registry `crates-io`
|
||||||
[NOTE] the registry may have a backlog that is delaying making the crate available. The crate should be available soon.
|
[NOTE] the registry may have a backlog that is delaying making the crate available. The crate should be available soon.
|
||||||
[ERROR] unable to publish main v0.0.1 and other v0.0.1 due to time out while waiting for published dependencies to be available.
|
[ERROR] unable to publish main v0.0.1 and other v0.0.1 due to time out while waiting for published dependencies to be available.
|
||||||
@ -3785,12 +3785,12 @@ fn workspace_with_local_deps_nightly() {
|
|||||||
[UPLOADING] level3 v0.0.1 ([ROOT]/foo/level3)
|
[UPLOADING] level3 v0.0.1 ([ROOT]/foo/level3)
|
||||||
[UPLOADED] level3 v0.0.1 to registry `crates-io`
|
[UPLOADED] level3 v0.0.1 to registry `crates-io`
|
||||||
[NOTE] waiting for level3 v0.0.1 to be available at registry `crates-io`.
|
[NOTE] waiting for level3 v0.0.1 to be available at registry `crates-io`.
|
||||||
You may press ctrl-c to skip waiting; the crate should be available shortly.
|
2 remaining crates to be published
|
||||||
[PUBLISHED] level3 v0.0.1 at registry `crates-io`
|
[PUBLISHED] level3 v0.0.1 at registry `crates-io`
|
||||||
[UPLOADING] level2 v0.0.1 ([ROOT]/foo/level2)
|
[UPLOADING] level2 v0.0.1 ([ROOT]/foo/level2)
|
||||||
[UPLOADED] level2 v0.0.1 to registry `crates-io`
|
[UPLOADED] level2 v0.0.1 to registry `crates-io`
|
||||||
[NOTE] waiting for level2 v0.0.1 to be available at registry `crates-io`.
|
[NOTE] waiting for level2 v0.0.1 to be available at registry `crates-io`.
|
||||||
You may press ctrl-c to skip waiting; the crate should be available shortly.
|
1 remaining crate to be published
|
||||||
[PUBLISHED] level2 v0.0.1 at registry `crates-io`
|
[PUBLISHED] level2 v0.0.1 at registry `crates-io`
|
||||||
[UPLOADING] level1 v0.0.1 ([ROOT]/foo/level1)
|
[UPLOADING] level1 v0.0.1 ([ROOT]/foo/level1)
|
||||||
[UPLOADED] level1 v0.0.1 to registry `crates-io`
|
[UPLOADED] level1 v0.0.1 to registry `crates-io`
|
||||||
@ -3890,7 +3890,7 @@ fn workspace_parallel() {
|
|||||||
[UPLOADED] b v0.0.1 to registry `crates-io`
|
[UPLOADED] b v0.0.1 to registry `crates-io`
|
||||||
[UPLOADED] a v0.0.1 to registry `crates-io`
|
[UPLOADED] a v0.0.1 to registry `crates-io`
|
||||||
[NOTE] waiting for a v0.0.1 or b v0.0.1 to be available at registry `crates-io`.
|
[NOTE] waiting for a v0.0.1 or b v0.0.1 to be available at registry `crates-io`.
|
||||||
You may press ctrl-c to skip waiting; the crates should be available shortly.
|
1 remaining crate to be published
|
||||||
[PUBLISHED] a v0.0.1 and b v0.0.1 at registry `crates-io`
|
[PUBLISHED] a v0.0.1 and b v0.0.1 at registry `crates-io`
|
||||||
[UPLOADING] c v0.0.1 ([ROOT]/foo/c)
|
[UPLOADING] c v0.0.1 ([ROOT]/foo/c)
|
||||||
[UPLOADED] c v0.0.1 to registry `crates-io`
|
[UPLOADED] c v0.0.1 to registry `crates-io`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user