History

feat: smart-release with --changelog-without option… (#198)

…to allow disabling various changelog segments like clippy, or commit statistics. Note that it's always possible to delete individual sections afterwards.

Sebastian Thiel committed 5 years ago

Commit ae8780e1 parent 509550f6 files · +12 −6Browse files

Unified · Split

6 files
  1. cargo-smart-release/src/changelog/init.rs +1 −2
  2. cargo-smart-release/src/changelog/section.rs +1 −2
  3. cargo-smart-release/src/cli/main.rs +2 −0
  4. cargo-smart-release/src/cli/options.rs +4 −0
  5. cargo-smart-release/src/command/mod.rs +3 −0
  6. cargo-smart-release/src/command/release/manifest.rs +1 −2
cargo-smart-release/src/changelog/init.rs+1−2
@@ -4,9 +4,8 @@ use cargo_metadata::{ · 3 unmodified lines
44 };
55 use git_repository as git;
66
7−use crate::changelog::section::segment;
87 use crate::{
9− changelog::Section,
8+ changelog::{section::segment, Section},
109 commit,
1110 utils::{package_by_name, will},
1211 ChangeLog,
cargo-smart-release/src/changelog/section.rs+1−2
@@ -118,10 +118,9 @@ mod from_history { · 117 unmodified lines
118118 use git_repository::prelude::ObjectIdExt;
119119 use time::OffsetDateTime;
120120
121− use crate::changelog::section::segment::Selection;
122121 use crate::{
123122 changelog,
124− changelog::{section, Section},
123+ changelog::{section, section::segment::Selection, Section},
125124 commit, utils,
126125 utils::is_top_level_package,
127126 };
cargo-smart-release/src/cli/main.rs+2−0
@@ -36,6 +36,7 @@ fn main() -> anyhow::Result<()> { · 35 unmodified lines
3636 no_publish,
3737 no_tag,
3838 no_push,
39+ changelog_without,
3940 dangerously_pass_no_verify,
4041 no_auto_publish_of_stable_crates,
4142 no_conservative_pre_release_version_handling,
@@ -67,6 +68,7 @@ fn main() -> anyhow::Result<()> { · 25 unmodified lines
6768 allow_auto_publish_of_stable_crates: !no_auto_publish_of_stable_crates,
6869 update_crates_index,
6970 preview: !no_changelog_preview,
71+ generator_segments: names_to_segment_selection(&changelog_without)?,
7072 },
7173 crates,
7274 bump.unwrap_or_else(|| "keep".into()),
cargo-smart-release/src/cli/options.rs+4−0
@@ -90,6 +90,10 @@ pub struct SmartRelease { · 89 unmodified lines
9090 #[argh(switch)]
9191 pub no_changelog: bool,
9292
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+
9397 /// if unset, about-to-be changed changelogs will be previewed using 'bat', if available.
9498 ///
9599 /// If set, no preview will ever be displayed, but note that empty changelogs will always stop the release process.
cargo-smart-release/src/command/mod.rs+3−0
@@ -1,4 +1,6 @@
11 pub mod release {
2+ use crate::changelog::section::segment;
3+
24 #[derive(Debug, Clone, Copy)]
35 pub struct Options {
46 pub dry_run: bool,
@@ -20,6 +22,7 @@ pub mod release { · 15 unmodified lines
2022 pub isolate_dependencies_from_breaking_changes: bool,
2123 pub changelog: bool,
2224 pub preview: bool,
25+ pub generator_segments: segment::Selection,
2326 }
2427 }
2528 #[path = "release/mod.rs"]
cargo-smart-release/src/command/release/manifest.rs+1−2
@@ -5,7 +5,6 @@ use cargo_metadata::{camino::Utf8PathBuf, Metadata, Package}; · 4 unmodified lines
55 use semver::{Op, Version, VersionReq};
66
77 use super::{cargo, git, version, Context, Oid, Options};
8−use crate::changelog::section::segment;
98 use crate::{
109 changelog,
1110 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
4241 history,
4342 &ctx.base,
4443 opts.dry_run,
45− segment::Selection::all(),
44+ opts.generator_segments,
4645 )?;
4746 let recent_release_in_log = log.most_recent_release_mut();
4847 let new_version: semver::Version = new_version.parse()?;