Skip to content

Commit

Permalink
Merge pull request #572 from epage/perf
Browse files Browse the repository at this point in the history
perf: Reduce owners overhead
  • Loading branch information
epage authored Oct 19, 2022
2 parents b45e6c1 + dd6844b commit b211fa9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/steps/owner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl OwnerStep {

pub fn ensure_owners(pkgs: &[plan::PackageRelease], dry_run: bool) -> Result<(), CliError> {
for pkg in pkgs {
if !pkg.config.publish() {
if !pkg.config.publish() || !pkg.ensure_owners {
continue;
}

Expand Down
4 changes: 4 additions & 0 deletions src/steps/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ pub struct PackageRelease {

pub planned_version: Option<Version>,
pub planned_tag: Option<String>,

pub ensure_owners: bool,
}

impl PackageRelease {
Expand Down Expand Up @@ -132,6 +134,7 @@ impl PackageRelease {

let planned_version = None;
let planned_tag = None;
let ensure_owners = config.publish() && !config.owners().is_empty();

let pkg = PackageRelease {
meta: pkg_meta.clone(),
Expand All @@ -151,6 +154,7 @@ impl PackageRelease {

planned_version,
planned_tag,
ensure_owners,
};
Ok(pkg)
}
Expand Down
4 changes: 4 additions & 0 deletions src/steps/release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ impl ReleaseStep {
if let Some(level_or_version) = &self.level_or_version {
pkg.bump(level_or_version, self.metadata.as_deref())?;
}
if index.crate_(&pkg.meta.name).is_some() {
// Already published, skip it. Use `cargo release owner` for one-time updates
pkg.ensure_owners = false;
}
}

let (_selected_pkgs, excluded_pkgs) = self.workspace.partition_packages(&ws_meta);
Expand Down

0 comments on commit b211fa9

Please sign in to comment.