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
4};4};
5use git_repository as git;5use git_repository as git;
6 6
7use crate::changelog::section::segment;
8use crate::{7use 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,
cargo-smart-release/src/changelog/section.rs+1−2
@@ -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 };
cargo-smart-release/src/cli/main.rs+2−0
@@ -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()),
cargo-smart-release/src/cli/options.rs+4−0
@@ -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.
cargo-smart-release/src/command/mod.rs+3−0
@@ -1,4 +1,6 @@
1pub mod release {1pub 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"]
cargo-smart-release/src/command/release/manifest.rs+1−2
@@ -5,7 +5,6 @@ use cargo_metadata::{camino::Utf8PathBuf, Metadata, Package}; · 4 unmodified lines
5use semver::{Op, Version, VersionReq};5use semver::{Op, Version, VersionReq};
6 6
7use super::{cargo, git, version, Context, Oid, Options};7use super::{cargo, git, version, Context, Oid, Options};
8use crate::changelog::section::segment;
9use crate::{8use 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()?;