mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
fix(publish): Show remaining packages to be published
This commit is contained in:
parent
f36cb83e98
commit
d2a6dcb43e
@ -210,7 +210,8 @@ pub fn publish(ws: &Workspace<'_>, opts: &PublishOpts<'_>) -> CargoResult<()> {
|
|||||||
// `b`, and we uploaded `a` and `b` but only confirmed `a`, then on
|
// `b`, and we uploaded `a` and `b` but only confirmed `a`, then on
|
||||||
// the following pass through the outer loop nothing will be ready for
|
// the following pass through the outer loop nothing will be ready for
|
||||||
// upload.
|
// upload.
|
||||||
for pkg_id in plan.take_ready() {
|
let mut ready = plan.take_ready();
|
||||||
|
while let Some(pkg_id) = ready.pop_first() {
|
||||||
let (pkg, (_features, tarball)) = &pkg_dep_graph.packages[&pkg_id];
|
let (pkg, (_features, tarball)) = &pkg_dep_graph.packages[&pkg_id];
|
||||||
opts.gctx.shell().status("Uploading", pkg.package_id())?;
|
opts.gctx.shell().status("Uploading", pkg.package_id())?;
|
||||||
|
|
||||||
@ -236,6 +237,19 @@ pub fn publish(ws: &Workspace<'_>, opts: &PublishOpts<'_>) -> CargoResult<()> {
|
|||||||
)?));
|
)?));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let workspace_context = || {
|
||||||
|
let mut remaining = ready.clone();
|
||||||
|
remaining.extend(plan.iter());
|
||||||
|
if !remaining.is_empty() {
|
||||||
|
format!(
|
||||||
|
"\n\nnote: the following crates have not been published yet:\n {}",
|
||||||
|
remaining.into_iter().join("\n ")
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
String::new()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
transmit(
|
transmit(
|
||||||
opts.gctx,
|
opts.gctx,
|
||||||
ws,
|
ws,
|
||||||
@ -244,6 +258,7 @@ pub fn publish(ws: &Workspace<'_>, opts: &PublishOpts<'_>) -> CargoResult<()> {
|
|||||||
&mut registry,
|
&mut registry,
|
||||||
source_ids.original,
|
source_ids.original,
|
||||||
opts.dry_run,
|
opts.dry_run,
|
||||||
|
workspace_context,
|
||||||
)?;
|
)?;
|
||||||
to_confirm.insert(pkg_id);
|
to_confirm.insert(pkg_id);
|
||||||
|
|
||||||
@ -632,6 +647,7 @@ fn transmit(
|
|||||||
registry: &mut Registry,
|
registry: &mut Registry,
|
||||||
registry_id: SourceId,
|
registry_id: SourceId,
|
||||||
dry_run: bool,
|
dry_run: bool,
|
||||||
|
workspace_context: impl Fn() -> String,
|
||||||
) -> CargoResult<()> {
|
) -> CargoResult<()> {
|
||||||
let new_crate = prepare_transmit(gctx, ws, pkg, registry_id)?;
|
let new_crate = prepare_transmit(gctx, ws, pkg, registry_id)?;
|
||||||
|
|
||||||
@ -643,10 +659,11 @@ fn transmit(
|
|||||||
|
|
||||||
let warnings = registry.publish(&new_crate, tarball).with_context(|| {
|
let warnings = registry.publish(&new_crate, tarball).with_context(|| {
|
||||||
format!(
|
format!(
|
||||||
"failed to publish {} v{} to registry at {}",
|
"failed to publish {} v{} to registry at {}{}",
|
||||||
pkg.name(),
|
pkg.name(),
|
||||||
pkg.version(),
|
pkg.version(),
|
||||||
registry.host()
|
registry.host(),
|
||||||
|
workspace_context()
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
@ -4474,8 +4474,8 @@ fn workspace_publish_rate_limit_error() {
|
|||||||
.file("package_c/src/lib.rs", "")
|
.file("package_c/src/lib.rs", "")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// This demonstrates the current non-actionable error message
|
// This demonstrates the improved error message after the fix
|
||||||
// The user doesn't know which package failed or what packages remain to be published
|
// The user now knows which package failed and what packages remain to be published
|
||||||
p.cargo("publish --workspace --no-verify")
|
p.cargo("publish --workspace --no-verify")
|
||||||
.replace_crates_io(registry.index_url())
|
.replace_crates_io(registry.index_url())
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
@ -4491,6 +4491,10 @@ fn workspace_publish_rate_limit_error() {
|
|||||||
[UPLOADING] package_a v0.1.0 ([ROOT]/foo/package_a)
|
[UPLOADING] package_a v0.1.0 ([ROOT]/foo/package_a)
|
||||||
[ERROR] failed to publish package_a v0.1.0 to registry at http://127.0.0.1:[..]/
|
[ERROR] failed to publish package_a v0.1.0 to registry at http://127.0.0.1:[..]/
|
||||||
|
|
||||||
|
[NOTE] the following crates have not been published yet:
|
||||||
|
package_b v0.1.0 ([ROOT]/foo/package_b)
|
||||||
|
package_c v0.1.0 ([ROOT]/foo/package_c)
|
||||||
|
|
||||||
Caused by:
|
Caused by:
|
||||||
failed to get a 200 OK response, got 429
|
failed to get a 200 OK response, got 429
|
||||||
headers:
|
headers:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user