Skip to content

Commit c330732

Browse files
authored
Fix; don't introduce newlines when merging duplicate changes sections. (#7)
1 parent 8a71b59 commit c330732

File tree

8 files changed

+114
-4
lines changed

8 files changed

+114
-4
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88

9+
## 0.3.3 - 2022-08-10
10+
11+
### Fixed
12+
13+
- Don't introduce newlines when merging duplicate changes sections.
14+
15+
916
## 0.3.2 - 2022-08-05
1017

1118
### Fixed

ocdc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.3.2"
1+
__version__ = "0.3.3"

ocdc/ast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Changes(BaseModel):
2424

2525
def merge(self, other: "Changes") -> None:
2626
self.items.extend(other.items)
27-
self.footer += "\n" + other.footer
27+
self.footer = f"{self.footer}\n{other.footer}".strip()
2828

2929

3030
class Version(BaseModel):

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "ocdc"
3-
version = "0.3.2"
3+
version = "0.3.3"
44
description = 'A changelog formatter for "people", neat freaks, and sloppy typists.'
55
authors = ["Matteo De Wint <[email protected]>"]
66
packages = [{ include = "ocdc" }]

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.3.2
2+
current_version = 0.3.3
33
commit = True
44

55
[flake8]

tests/data/duplicate_changes_sections.ast.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,53 @@
22
"title": "Changelog",
33
"intro": "All notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).",
44
"versions": [
5+
{
6+
"number": "0.3.0",
7+
"date": "2022-08-10",
8+
"changes": {
9+
"Added": {
10+
"items": [
11+
{
12+
"text": "Initial version."
13+
},
14+
{
15+
"text": "Another added item."
16+
}
17+
],
18+
"footer": "[one]: http://example.com/one"
19+
},
20+
"Changed": {
21+
"items": [
22+
{
23+
"text": "Something changed."
24+
}
25+
]
26+
}
27+
}
28+
},
29+
{
30+
"number": "0.2.0",
31+
"date": "2022-08-10",
32+
"changes": {
33+
"Added": {
34+
"items": [
35+
{
36+
"text": "Initial version."
37+
},
38+
{
39+
"text": "Another added item."
40+
}
41+
]
42+
},
43+
"Changed": {
44+
"items": [
45+
{
46+
"text": "Something changed."
47+
}
48+
]
49+
}
50+
}
51+
},
552
{
653
"number": "0.1.0",
754
"date": "2022-07-31",

tests/data/duplicate_changes_sections.in.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,36 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## 0.3.0 - 2022-08-10
9+
10+
### Added
11+
12+
- Initial version.
13+
14+
### Changed
15+
16+
- Something changed.
17+
18+
### Added
19+
20+
- Another added item.
21+
22+
[one]: http://example.com/one
23+
24+
## 0.2.0 - 2022-08-10
25+
26+
### Added
27+
28+
- Initial version.
29+
30+
### Changed
31+
32+
- Something changed.
33+
34+
### Added
35+
36+
- Another added item.
37+
838
## 0.1.0 - 2022-07-31
939

1040
### Added

tests/data/duplicate_changes_sections.out.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,32 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88

9+
## 0.3.0 - 2022-08-10
10+
11+
### Added
12+
13+
- Initial version.
14+
- Another added item.
15+
16+
[one]: http://example.com/one
17+
18+
### Changed
19+
20+
- Something changed.
21+
22+
23+
## 0.2.0 - 2022-08-10
24+
25+
### Added
26+
27+
- Initial version.
28+
- Another added item.
29+
30+
### Changed
31+
32+
- Something changed.
33+
34+
935
## 0.1.0 - 2022-07-31
1036

1137
### Added

0 commit comments

Comments
 (0)