Skip to content

Commit 4eebaac

Browse files
committed
Allow 'refactor' and 'other' in conventional messages if they have breaking changes (#198)
1 parent c1f3c9d commit 4eebaac

File tree

13 files changed

+153
-86
lines changed

13 files changed

+153
-86
lines changed

cargo-smart-release/src/changelog/parse.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ impl Section {
162162
|| title.starts_with(as_headline("change").expect("valid"))
163163
|| title.starts_with(as_headline("docs").expect("valid"))
164164
|| title.starts_with(as_headline("perf").expect("valid"))
165+
|| title.starts_with("refactor")
166+
|| title.starts_with("other")
165167
|| title.starts_with(as_headline("fix").expect("valid")) =>
166168
{
167169
State::ParseConventional {
@@ -226,11 +228,13 @@ fn parse_conventional_to_next_section_title(
226228
level: u32,
227229
unknown: &mut String,
228230
) -> Segment {
229-
let is_breaking = title.ends_with(section::segment::Conventional::BREAKING_TITLE);
230-
let kind = ["fix", "add", "feat", "revert", "remove", "change", "docs", "perf"]
231-
.iter()
232-
.find(|kind| title.starts_with(section::segment::conventional::as_headline(*kind).expect("valid")))
233-
.expect("BUG: this list needs an update too if new kinds of conventional messages are added");
231+
let is_breaking = title.ends_with(section::segment::Conventional::BREAKING_TITLE_ENCLOSED);
232+
let kind = [
233+
"fix", "add", "feat", "revert", "remove", "change", "docs", "perf", "refactor", "other",
234+
]
235+
.iter()
236+
.find(|kind| title.starts_with(section::segment::conventional::as_headline(*kind).unwrap_or(*kind)))
237+
.expect("BUG: this list needs an update too if new kinds of conventional messages are added");
234238

235239
let mut conventional = section::segment::Conventional {
236240
kind: *kind,

cargo-smart-release/src/changelog/section/segment.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub mod conventional {
2222
}
2323

2424
/// Note that this depends on `crate::commit::message::to_static()`,
25+
/// Note having a headline means it won't be written back unless it contains breaking changes.
2526
pub fn as_headline(kind: &str) -> Option<&'static str> {
2627
// NOTE: adding one here needs additions to parse.rs
2728
Some(match kind {
@@ -52,7 +53,8 @@ pub struct Conventional {
5253

5354
impl Conventional {
5455
pub const REMOVED_HTML_PREFIX: &'static str = "<csr-id-";
55-
pub const BREAKING_TITLE: &'static str = "(BREAKING)";
56+
pub const BREAKING_TITLE: &'static str = "BREAKING";
57+
pub const BREAKING_TITLE_ENCLOSED: &'static str = "(BREAKING)";
5658
}
5759

5860
pub mod details {

cargo-smart-release/src/changelog/write.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@ impl section::Segment {
8989
is_breaking,
9090
removed,
9191
messages,
92-
}) => match segment::conventional::as_headline(kind) {
92+
}) => match segment::conventional::as_headline(kind).or_else(|| is_breaking.then(|| *kind)) {
9393
Some(headline) => {
9494
writeln!(
9595
out,
9696
"{} {}{}\n",
9797
heading(section_level),
9898
headline,
9999
if *is_breaking {
100-
format!(" {}", segment::Conventional::BREAKING_TITLE)
100+
format!(" {}", segment::Conventional::BREAKING_TITLE_ENCLOSED)
101101
} else {
102102
"".into()
103103
},

git-actor/CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
<csr-read-only-do-not-edit/>
1313

14-
- 1 commit contributed to the release.
14+
- 2 commits contributed to the release.
1515
- 0 commits where understood as [conventional](https://www.conventionalcommits.org).
16-
- 1 unique issue was worked on
16+
- 2 unique issues were worked on
1717

1818
### Commit Details
1919

2020
<csr-read-only-do-not-edit/>
2121

2222
<details><summary>view details</summary>
2323

24+
* **#198**
25+
- new changelogs for actor and features crates (e0d437c)
2426
* **Uncategorized**
2527
- make fmt, but now it picked up some parts that usually don't get altered… (01f7b72)
2628
</details>

git-diff/CHANGELOG.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
<csr-read-only-do-not-edit/>
1313

14-
- 10 commits contributed to the release over the course of 14 calendar days.
14+
- 12 commits contributed to the release over the course of 26 calendar days.
1515
- 0 commits where understood as [conventional](https://www.conventionalcommits.org).
1616
- 2 unique issues were worked on
1717

@@ -22,16 +22,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222
<details><summary>view details</summary>
2323

2424
* **#198**
25-
- Rebuild all changelogs to assure properly ordered headlines (cfcaa66)
26-
- Sort all commits by time, descending… (7c37a3d)
27-
- greatly reduce changelog size now that the traversal fix is applied (3924c03)
28-
- Generate changelogs with details (fd0f3bd)
29-
- Update all changelogs with details (0732699)
30-
- Update changelogs (b30db3b)
25+
- Rebuild all changelogs to assure properly ordered headlines (4a9a05f)
26+
- Sort all commits by time, descending… (f536bad)
27+
- greatly reduce changelog size now that the traversal fix is applied (a0bc98c)
28+
- Generate changelogs with details (e1861ca)
29+
- Update all changelogs with details (58ab2ae)
30+
- Update changelogs (c857d61)
3131
- Avoid adding newlines which make writing unstable (6b5c394)
3232
- Fix section headline level (9d6f263)
3333
- Write first version of changlogs thus far… (719b6bd)
3434
* **Uncategorized**
35+
- make fmt, but now it picked up some parts that usually don't get altered… (01f7b72)
36+
- Update changelogs just for fun (21541b3)
3537
- Bump git-traverse v0.9.0, safety bump 8 crates (d39fabb)
3638
</details>
3739

git-features/CHANGELOG.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
<csr-read-only-do-not-edit/>
1313

14-
- 1 commit contributed to the release.
14+
- 2 commits contributed to the release over the course of 1 calendar day.
1515
- 0 commits where understood as [conventional](https://www.conventionalcommits.org).
16-
- 1 unique issue was worked on
16+
- 2 unique issues were worked on
1717

1818
### Commit Details
1919

2020
<csr-read-only-do-not-edit/>
2121

2222
<details><summary>view details</summary>
2323

24+
* **#198**
25+
- new changelogs for actor and features crates (e0d437c)
2426
* **Uncategorized**
2527
- make fmt, but now it picked up some parts that usually don't get altered… (01f7b72)
2628
</details>
@@ -624,10 +626,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
624626

625627
## v0.1.0 (2020-07-12)
626628

627-
### other
628-
629-
- <csr-id-ab6f98b905f13ed2a7c0c483f34fab63141fbc5b/> try-join with static typing works, but…
630-
631629
### Commit Statistics
632630

633631
<csr-read-only-do-not-edit/>

git-hash/CHANGELOG.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
### New Features
11+
12+
- <csr-id-ed16bce97c235e7e188444afd7a0d3f7e04a6c72/> `oid::short_hex(len)` for truncated hex representations
13+
1014
### Commit Statistics
1115

1216
<csr-read-only-do-not-edit/>
1317

14-
- 7 commits contributed to the release.
18+
- 8 commits contributed to the release over the course of 7 calendar days.
1519
- 2 commits where understood as [conventional](https://www.conventionalcommits.org).
16-
- 1 unique issue was worked on
20+
- 2 unique issues were worked on
1721

1822
### Commit Details
1923

@@ -22,13 +26,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2226
<details><summary>view details</summary>
2327

2428
* **#198**
25-
- Rebuild all changelogs to assure properly ordered headlines (cfcaa66)
26-
- Sort all commits by time, descending… (7c37a3d)
27-
- greatly reduce changelog size now that the traversal fix is applied (3924c03)
28-
- rename `oid::short_hex()` to `oid::to_hex()` (deb99b3)
29-
- Fixup remaining changelogs… (0ac488a)
30-
- Generate changelogs with details (fd0f3bd)
31-
- oid::short_hex(len) for truncated hex representations (d234b97)
29+
- Rebuild all changelogs to assure properly ordered headlines (4a9a05f)
30+
- Sort all commits by time, descending… (f536bad)
31+
- greatly reduce changelog size now that the traversal fix is applied (a0bc98c)
32+
- rename `oid::short_hex()` to `oid::to_hex()` (8be4036)
33+
- Fixup remaining changelogs… (2f75db2)
34+
- Generate changelogs with details (e1861ca)
35+
- oid::short_hex(len) for truncated hex representations (ed16bce)
36+
* **Uncategorized**
37+
- Update changelogs just for fun (21541b3)
3238
</details>
3339

3440
## v0.6.0 (2021-09-07)

git-lock/CHANGELOG.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
<csr-read-only-do-not-edit/>
1313

14-
- 5 commits contributed to the release over the course of 33 calendar days.
14+
- 6 commits contributed to the release over the course of 45 calendar days.
1515
- 0 commits where understood as [conventional](https://www.conventionalcommits.org).
1616
- 2 unique issues were worked on
1717

@@ -22,11 +22,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222
<details><summary>view details</summary>
2323

2424
* **#198**
25-
- Rebuild all changelogs to assure properly ordered headlines (cfcaa66)
26-
- Sort all commits by time, descending… (7c37a3d)
27-
- greatly reduce changelog size now that the traversal fix is applied (3924c03)
28-
- Fixup remaining changelogs… (0ac488a)
25+
- Rebuild all changelogs to assure properly ordered headlines (4a9a05f)
26+
- Sort all commits by time, descending… (f536bad)
27+
- greatly reduce changelog size now that the traversal fix is applied (a0bc98c)
28+
- Fixup remaining changelogs… (2f75db2)
2929
* **Uncategorized**
30+
- Update changelogs just for fun (21541b3)
3031
- Merge pull request #172 from mellowagain/main (61aebbf)
3132
</details>
3233

git-object/CHANGELOG.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
### Performance
11+
12+
- <csr-id-83d591d536d1a43e8523082824ec0b95cca55d34/> parse entry mode into number instead of comparing it to byte strings
13+
- <csr-id-f9232acf8e52f8cd95520d122469e136eb07b39f/> ObjectID specific hashers, using the fact that object ids are hashes
14+
1015
### Commit Statistics
1116

1217
<csr-read-only-do-not-edit/>
1318

14-
- 40 commits contributed to the release over the course of 11 calendar days.
19+
- 41 commits contributed to the release over the course of 23 calendar days.
1520
- 3 commits where understood as [conventional](https://www.conventionalcommits.org).
1621
- 3 unique issues were worked on
1722

@@ -22,12 +27,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2227
<details><summary>view details</summary>
2328

2429
* **#198**
25-
- Rebuild all changelogs to assure properly ordered headlines (cfcaa66)
26-
- Sort all commits by time, descending… (7c37a3d)
27-
- greatly reduce changelog size now that the traversal fix is applied (3924c03)
28-
- Generate changelogs with details (fd0f3bd)
29-
- Update all changelogs with details (0732699)
30-
- Update changelogs (b30db3b)
30+
- Rebuild all changelogs to assure properly ordered headlines (4a9a05f)
31+
- Sort all commits by time, descending… (f536bad)
32+
- greatly reduce changelog size now that the traversal fix is applied (a0bc98c)
33+
- Generate changelogs with details (e1861ca)
34+
- Update all changelogs with details (58ab2ae)
35+
- Update changelogs (c857d61)
3136
- Avoid adding newlines which make writing unstable (6b5c394)
3237
- Fix section headline level (9d6f263)
3338
- Write first version of changlogs thus far… (719b6bd)
@@ -60,6 +65,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6065
- ObjectID specific hashers, using the fact that object ids are hashes (f9232ac)
6166
- Tree parsing now probably is twice as fast… (d1e2b89)
6267
* **Uncategorized**
68+
- Update changelogs just for fun (21541b3)
6369
- Merge branch 'main' into changelog-generation (c956f33)
6470
- thanks clippy (d78d382)
6571
- thanks clippy (4ea1126)

git-odb/CHANGELOG.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
<csr-read-only-do-not-edit/>
1313

14-
- 13 commits contributed to the release over the course of 14 calendar days.
14+
- 14 commits contributed to the release over the course of 26 calendar days.
1515
- 0 commits where understood as [conventional](https://www.conventionalcommits.org).
1616
- 3 unique issues were worked on
1717

@@ -22,20 +22,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222
<details><summary>view details</summary>
2323

2424
* **#198**
25-
- Rebuild all changelogs to assure properly ordered headlines (cfcaa66)
26-
- Sort all commits by time, descending… (7c37a3d)
27-
- greatly reduce changelog size now that the traversal fix is applied (3924c03)
28-
- Fixup remaining changelogs… (0ac488a)
29-
- Generate changelogs with details (fd0f3bd)
30-
- Update all changelogs with details (0732699)
31-
- Update changelogs (b30db3b)
25+
- Rebuild all changelogs to assure properly ordered headlines (4a9a05f)
26+
- Sort all commits by time, descending… (f536bad)
27+
- greatly reduce changelog size now that the traversal fix is applied (a0bc98c)
28+
- Fixup remaining changelogs… (2f75db2)
29+
- Generate changelogs with details (e1861ca)
30+
- Update all changelogs with details (58ab2ae)
31+
- Update changelogs (c857d61)
3232
- Avoid adding newlines which make writing unstable (6b5c394)
3333
- Fix section headline level (9d6f263)
3434
- Write first version of changlogs thus far… (719b6bd)
3535
- Parse more user generated section content, adapt existing changelogs to work correctly (2f43a54)
3636
* **#67**
3737
- Assure pack-ids are actually unique, the simple way… (0509b4f)
3838
* **Uncategorized**
39+
- Update changelogs just for fun (21541b3)
3940
- Bump git-traverse v0.9.0, safety bump 8 crates (d39fabb)
4041
</details>
4142

0 commit comments

Comments
 (0)