Skip to content

Commit

Permalink
Merge unreleased now only merges project-specific changes into each p…
Browse files Browse the repository at this point in the history
…roject. (#570)

* Pass project name when getting unreleased changes for merge
* Release v1.15.1 for the fix

---------

Co-authored-by: Ronnie Smith <[email protected]>
  • Loading branch information
TheSpyder and miniscruff authored Oct 30, 2023
1 parent 924255d commit 464aea8
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changes/v1.15.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## v1.15.1 on 2023-10-29

### Fixed

* [#569](https://github.com/miniscruff/changie/issues/569) Merge unreleased now only merges project-specific changes into each project.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [itself](https://github.com/miniscruff/changie).

## v1.15.1 on 2023-10-29

### Fixed

* [#569](https://github.com/miniscruff/changie/issues/569) Merge unreleased now only merges project-specific changes into each project.

## v1.15.0 on 2023-10-27

### Added
Expand Down
2 changes: 1 addition & 1 deletion cmd/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (m *Merge) mergeProject(cfg *core.Config, project, changelogPath string) er
nil,
m.ReadDir,
m.ReadFile,
"",
project,
)
if unrelErr != nil {
return unrelErr
Expand Down
60 changes: 59 additions & 1 deletion cmd/merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ first version
then.FileContents(t, changeContents, "a", "thing", "CHANGELOG.md")
}

func TestMergeVersionsErrorInvalidProject(t *testing.T) {
func TestMergeVersionsErrorMissingProjectDir(t *testing.T) {
cfg := mergeTestConfig()
cfg.HeaderPath = ""
cfg.Replacements = nil
Expand Down Expand Up @@ -220,6 +220,64 @@ func TestMergeVersionsWithUnreleasedChangesErrorsOnBadChangeFormat(t *testing.T)
then.NotNil(t, err)
}

func TestMergeVersionsWithUnreleasedChangesInOneProject(t *testing.T) {
cfg := mergeTestConfig()
cfg.HeaderPath = ""
cfg.Replacements = nil
cfg.Projects = []core.ProjectConfig{
{
Label: "A thing",
Key: "a",
ChangelogPath: "a/thing/CHANGELOG.md",
},
{
Label: "B thing",
Key: "b",
ChangelogPath: "b/thing/CHANGELOG.md",
},
}
then.WithTempDirConfig(t, cfg)

then.WriteFile(t, []byte("first A version\n"), cfg.ChangesDir, "a", "v0.1.0.md")
then.WriteFile(t, []byte("second A version\n"), cfg.ChangesDir, "a", "v0.2.0.md")
then.Nil(t, os.MkdirAll(filepath.Join("a", "thing"), core.CreateDirMode))
then.WriteFile(t, []byte("first B version\n"), cfg.ChangesDir, "b", "v0.1.0.md")
then.WriteFile(t, []byte("second B version\n"), cfg.ChangesDir, "b", "v0.2.0.md")
then.Nil(t, os.MkdirAll(filepath.Join("b", "thing"), core.CreateDirMode))

unrel := core.Change{
Kind: "Added",
Body: "new feature coming soon",
Project: "a",
}
writeChangeFile(t, cfg, &unrel)

cmd := NewMerge(
os.ReadFile,
os.WriteFile,
os.ReadDir,
os.Open,
os.Create,
core.NewTemplateCache(),
)
cmd.UnreleasedHeader = "## Coming Soon"
err := cmd.Run(cmd.Command, nil)
then.Nil(t, err)

changeContentsA := `## Coming Soon
### Added
* new feature coming soon
second A version
first A version
`
then.FileContents(t, changeContentsA, "a", "thing", "CHANGELOG.md")

changeContentsB := `second B version
first B version
`
then.FileContents(t, changeContentsB, "b", "thing", "CHANGELOG.md")
}

func TestMergeVersionsWithHeaderAndReplacements(t *testing.T) {
cfg := mergeTestConfig()
then.WithTempDirConfig(t, cfg)
Expand Down
2 changes: 1 addition & 1 deletion docs/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ summaryLength = 30
]
enable_anchor_link = true
issues_url = 'https://github.com/miniscruff/changie/issues/new'
version = 'v1.15.0'
version = 'v1.15.1'

[params.homepage_meta_tags]
meta_description = "Changie is a file based changelog management tool."
Expand Down
2 changes: 1 addition & 1 deletion docs/static/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"latest": "v1.15.0"
"latest": "v1.15.1"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "changie",
"version": "1.15.0",
"version": "1.15.1",
"author": "miniscruff",
"description": "Automated changelog tool for preparing releases with lots of customization options",
"bin": {
Expand Down

0 comments on commit 464aea8

Please sign in to comment.