…to allow disabling various changelog segments like clippy, or commit statistics. Note that it's always possible to delete individual sections afterwards.
Unified · Split
| @@ -4,9 +4,8 @@ use cargo_metadata::{ · 3 unmodified lines | |||
| 4 | }; | 4 | }; |
| 5 | use git_repository as git; | 5 | use git_repository as git; |
| 6 | 6 | ||
| 7 | use crate::changelog::section::segment; | ||
| 8 | use crate::{ | 7 | use crate::{ |
| 9 | changelog::Section, | 8 | changelog::{section::segment, Section}, |
| 10 | commit, | 9 | commit, |
| 11 | utils::{package_by_name, will}, | 10 | utils::{package_by_name, will}, |
| 12 | ChangeLog, | 11 | ChangeLog, |
| @@ -118,10 +118,9 @@ mod from_history { · 117 unmodified lines | |||
| 118 | use git_repository::prelude::ObjectIdExt; | 118 | use git_repository::prelude::ObjectIdExt; |
| 119 | use time::OffsetDateTime; | 119 | use time::OffsetDateTime; |
| 120 | 120 | ||
| 121 | use crate::changelog::section::segment::Selection; | ||
| 122 | use crate::{ | 121 | use crate::{ |
| 123 | changelog, | 122 | changelog, |
| 124 | changelog::{section, Section}, | 123 | changelog::{section, section::segment::Selection, Section}, |
| 125 | commit, utils, | 124 | commit, utils, |
| 126 | utils::is_top_level_package, | 125 | utils::is_top_level_package, |
| 127 | }; | 126 | }; |
| @@ -36,6 +36,7 @@ fn main() -> anyhow::Result<()> { · 35 unmodified lines | |||
| 36 | no_publish, | 36 | no_publish, |
| 37 | no_tag, | 37 | no_tag, |
| 38 | no_push, | 38 | no_push, |
| 39 | changelog_without, | ||
| 39 | dangerously_pass_no_verify, | 40 | dangerously_pass_no_verify, |
| 40 | no_auto_publish_of_stable_crates, | 41 | no_auto_publish_of_stable_crates, |
| 41 | no_conservative_pre_release_version_handling, | 42 | no_conservative_pre_release_version_handling, |
| @@ -67,6 +68,7 @@ fn main() -> anyhow::Result<()> { · 25 unmodified lines | |||
| 67 | allow_auto_publish_of_stable_crates: !no_auto_publish_of_stable_crates, | 68 | allow_auto_publish_of_stable_crates: !no_auto_publish_of_stable_crates, |
| 68 | update_crates_index, | 69 | update_crates_index, |
| 69 | preview: !no_changelog_preview, | 70 | preview: !no_changelog_preview, |
| 71 | generator_segments: names_to_segment_selection(&changelog_without)?, | ||
| 70 | }, | 72 | }, |
| 71 | crates, | 73 | crates, |
| 72 | bump.unwrap_or_else(|| "keep".into()), | 74 | bump.unwrap_or_else(|| "keep".into()), |
| @@ -90,6 +90,10 @@ pub struct SmartRelease { · 89 unmodified lines | |||
| 90 | #[argh(switch)] | 90 | #[argh(switch)] |
| 91 | pub no_changelog: bool, | 91 | pub no_changelog: bool, |
| 92 | 92 | ||
| 93 | /// omits these kinds of generated changelog content, values are 'clippy', 'commit-statistics' and 'commit-details' | ||
| 94 | #[argh(option)] | ||
| 95 | pub changelog_without: Vec<String>, | ||
| 96 | |||
| 93 | /// if unset, about-to-be changed changelogs will be previewed using 'bat', if available. | 97 | /// if unset, about-to-be changed changelogs will be previewed using 'bat', if available. |
| 94 | /// | 98 | /// |
| 95 | /// If set, no preview will ever be displayed, but note that empty changelogs will always stop the release process. | 99 | /// If set, no preview will ever be displayed, but note that empty changelogs will always stop the release process. |
| @@ -1,4 +1,6 @@ | |||
| 1 | pub mod release { | 1 | pub mod release { |
| 2 | use crate::changelog::section::segment; | ||
| 3 | |||
| 2 | #[derive(Debug, Clone, Copy)] | 4 | #[derive(Debug, Clone, Copy)] |
| 3 | pub struct Options { | 5 | pub struct Options { |
| 4 | pub dry_run: bool, | 6 | pub dry_run: bool, |
| @@ -20,6 +22,7 @@ pub mod release { · 15 unmodified lines | |||
| 20 | pub isolate_dependencies_from_breaking_changes: bool, | 22 | pub isolate_dependencies_from_breaking_changes: bool, |
| 21 | pub changelog: bool, | 23 | pub changelog: bool, |
| 22 | pub preview: bool, | 24 | pub preview: bool, |
| 25 | pub generator_segments: segment::Selection, | ||
| 23 | } | 26 | } |
| 24 | } | 27 | } |
| 25 | #[path = "release/mod.rs"] | 28 | #[path = "release/mod.rs"] |
| @@ -5,7 +5,6 @@ use cargo_metadata::{camino::Utf8PathBuf, Metadata, Package}; · 4 unmodified lines | |||
| 5 | use semver::{Op, Version, VersionReq}; | 5 | use semver::{Op, Version, VersionReq}; |
| 6 | 6 | ||
| 7 | use super::{cargo, git, version, Context, Oid, Options}; | 7 | use super::{cargo, git, version, Context, Oid, Options}; |
| 8 | use crate::changelog::section::segment; | ||
| 9 | use crate::{ | 8 | use crate::{ |
| 10 | changelog, | 9 | changelog, |
| 11 | utils::{names_and_versions, package_by_id, package_eq_dependency, will}, | 10 | utils::{names_and_versions, package_by_id, package_eq_dependency, will}, |
| @@ -42,7 +41,7 @@ pub(in crate::command::release_impl) fn edit_version_and_fixup_dependent_crates_ · 30 unmodified lines | |||
| 42 | history, | 41 | history, |
| 43 | &ctx.base, | 42 | &ctx.base, |
| 44 | opts.dry_run, | 43 | opts.dry_run, |
| 45 | segment::Selection::all(), | 44 | opts.generator_segments, |
| 46 | )?; | 45 | )?; |
| 47 | let recent_release_in_log = log.most_recent_release_mut(); | 46 | let recent_release_in_log = log.most_recent_release_mut(); |
| 48 | let new_version: semver::Version = new_version.parse()?; | 47 | let new_version: semver::Version = new_version.parse()?; |