History

merge doesn't consider user generated sections, only the ones it would want to add (#198)

Sebastian Thiel committed 5 years ago

Commit ebbebdd1 parent adfbd0d5 files · +55 −43Browse files

Unified · Split

5 files
  1. cargo-smart-release/src/changelog/merge.rs +1 −1
  2. cargo-smart-release/src/changelog/mod.rs +0 −9
  3. cargo-smart-release/src/changelog/section/mod.rs +9 −0
  4. cargo-smart-release/tests/changelog/merge.rs +13 −2
  5. git-repository/CHANGELOG.md +32 −31
cargo-smart-release/src/changelog/merge.rs+1−1
@@ -70,7 +70,7 @@ fn merge_section(dest: &mut Section, src: Section) { · 69 unmodified lines
7070 },
7171 ) => {
7272 assert!(rhs_unknown.is_empty(), "shouldn't ever generate 'unknown' portions");
73− let mode = if lhs_segments.is_empty() {
73+ let mode = if !lhs_segments.iter().any(|s| s.is_read_only()) {
7474 ReplaceMode::ReplaceAllOrAppend
7575 } else {
7676 ReplaceMode::ReplaceAllOrAppendIfPresentInLhs
cargo-smart-release/src/changelog/mod.rs+0−9
@@ -76,12 +76,3 @@ impl Section { · 75 unmodified lines
7676 }
7777 }
7878 }
79−
80−impl section::Segment {
81− pub fn is_read_only(&self) -> bool {
82− match self {
83− section::Segment::User { .. } | section::Segment::Conventional { .. } => false,
84− section::Segment::Clippy(_) | section::Segment::Statistics(_) | section::Segment::Details(_) => true,
85− }
86− }
87−}
cargo-smart-release/src/changelog/section/mod.rs+9−0
@@ -27,3 +27,12 @@ impl<T: PartialEq<T>> PartialEq<Data<T>> for Data<T> { · 26 unmodified lines
2727 }
2828 }
2929 }
30+
31+impl Segment {
32+ pub fn is_read_only(&self) -> bool {
33+ match self {
34+ Segment::User { .. } | Segment::Conventional { .. } => false,
35+ Segment::Clippy(_) | Segment::Statistics(_) | Segment::Details(_) => true,
36+ }
37+ }
38+}
cargo-smart-release/tests/changelog/merge.rs+13−2
@@ -163,7 +163,9 @@ fn into_previously_generated_with_removed_statistical_segments() { · 162 unmodified lines
163163 .assume_utc(),
164164 ),
165165 name: changelog::Version::Semantic("1.0.0".parse().unwrap()),
166− segments: vec![], // all segments removed
166+ segments: vec![section::Segment::User {
167+ text: "user generated".into(),
168+ }], // all segments removed, but user segment present
167169 unknown: "".into(),
168170 },
169171 Section::Release {
@@ -248,7 +250,16 @@ fn into_previously_generated_with_removed_statistical_segments() { · 78 unmodified lines
248250 .assume_utc(),
249251 ),
250252 name: changelog::Version::Semantic("1.0.0".parse().unwrap()),
251− segments,
253+ segments: {
254+ let mut s = segments.clone();
255+ s.insert(
256+ 0,
257+ section::Segment::User {
258+ text: "user generated".into(),
259+ },
260+ );
261+ s
262+ },
252263 unknown: "".into(),
253264 },
254265 Section::Release {
git-repository/CHANGELOG.md+32−31
@@ -18,10 +18,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 · 17 unmodified lines
1818
1919 <csr-read-only-do-not-edit/>
2020
21− - 76 commits contributed to the release over the course of 16 calendar days.
21+ - 77 commits contributed to the release over the course of 18 calendar days.
2222 - 34 commits where understood as [conventional](https://www.conventionalcommits.org).
2323 - 5 unique issues were worked on
2424
25+### Thanks Clippy
26+
27+<csr-read-only-do-not-edit/>
28+
29+[Clippy](https://github.com/rust-lang/rust-clippy) helped 3 times to make code idiomatic.
30+
2531 ### Commit Details
2632
2733 <csr-read-only-do-not-edit/>
@@ -88,6 +94,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 · 60 unmodified lines
8894 - Use Easy in the one spot where it is possible… (6a97bfa)
8995 - try to create persistent Easy iterator, but can't make it Send… (54a64a5)
9096 * **Uncategorized**
97+ - Update changelogs just for fun (fa91ba3)
9198 - Merge branch 'main' into changelog-generation (c956f33)
9299 - thanks clippy (ae7826e)
93100 - thanks clippy (b02edb5)
@@ -111,12 +118,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 · 17 unmodified lines
111118 - [repository #164] (4111d22)
112119 </details>
113120
114−### Thanks Clippy
115−
116−<csr-read-only-do-not-edit/>
117−
118−[Clippy](https://github.com/rust-lang/rust-clippy) helped 3 times to make code idiomatic.
119−
120121 ## v0.9.1 (2021-09-10)
121122
122123 - Remove `max-performance` feature from default set until the `msvc` build issue is fixed. Otherwise it will surprisingly break windows builds.
@@ -200,6 +201,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 · 77 unmodified lines
200201 - 0 commits where understood as [conventional](https://www.conventionalcommits.org).
201202 - 1 unique issue was worked on
202203
204+### Thanks Clippy
205+
206+<csr-read-only-do-not-edit/>
207+
208+[Clippy](https://github.com/rust-lang/rust-clippy) helped 3 times to make code idiomatic.
209+
203210 ### Commit Details
204211
205212 <csr-read-only-do-not-edit/>
@@ -275,12 +282,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 · 69 unmodified lines
275282 - [repository #185] refactor repository initialization… (5ff7eaa)
276283 </details>
277284
278−### Thanks Clippy
279−
280−<csr-read-only-do-not-edit/>
281−
282−[Clippy](https://github.com/rust-lang/rust-clippy) helped 3 times to make code idiomatic.
283−
284285 ## v0.8.1 (2021-08-28)
285286
286287 - Introduce `EasyArcExclusive` type, now available thanks to `parking_lot` 0.11.2
@@ -316,6 +317,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 · 29 unmodified lines
316317 - 0 commits where understood as [conventional](https://www.conventionalcommits.org).
317318 - 1 unique issue was worked on
318319
320+### Thanks Clippy
321+
322+<csr-read-only-do-not-edit/>
323+
324+[Clippy](https://github.com/rust-lang/rust-clippy) helped 4 times to make code idiomatic.
325+
319326 ### Commit Details
320327
321328 <csr-read-only-do-not-edit/>
@@ -442,20 +449,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 · 120 unmodified lines
442449 - [smart-release #162] FAIL: promising at first, but not really working… (fa01f76)
443450 </details>
444451
445−### Thanks Clippy
446−
447−<csr-read-only-do-not-edit/>
448−
449−[Clippy](https://github.com/rust-lang/rust-clippy) helped 4 times to make code idiomatic.
450−
451452 ## v0.7.2 (2021-08-17)
452453
453−### Thanks Clippy
454−
455−<csr-read-only-do-not-edit/>
456−
457−[Clippy](https://github.com/rust-lang/rust-clippy) helped 1 time to make code idiomatic.
458−
459454 ### Commit Statistics
460455
461456 <csr-read-only-do-not-edit/>
@@ -464,6 +459,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 · 2 unmodified lines
464459 - 0 commits where understood as [conventional](https://www.conventionalcommits.org).
465460 - 1 unique issue was worked on
466461
462+### Thanks Clippy
463+
464+<csr-read-only-do-not-edit/>
465+
466+[Clippy](https://github.com/rust-lang/rust-clippy) helped 1 time to make code idiomatic.
467+
467468 ### Commit Details
468469
469470 <csr-read-only-do-not-edit/>
@@ -541,6 +542,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 · 71 unmodified lines
541542 - 0 commits where understood as [conventional](https://www.conventionalcommits.org).
542543 - 1 unique issue was worked on
543544
545+### Thanks Clippy
546+
547+<csr-read-only-do-not-edit/>
548+
549+[Clippy](https://github.com/rust-lang/rust-clippy) helped 1 time to make code idiomatic.
550+
544551 ### Commit Details
545552
546553 <csr-read-only-do-not-edit/>
@@ -591,12 +598,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 · 44 unmodified lines
591598 - (cargo-release) version 0.2.0 (3286e42)
592599 </details>
593600
594−### Thanks Clippy
595−
596−<csr-read-only-do-not-edit/>
597−
598−[Clippy](https://github.com/rust-lang/rust-clippy) helped 1 time to make code idiomatic.
599−
600601 ## v0.6.0 (2021-05-28)
601602
602603 ### Commit Statistics

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t