@@ -1406,3 +1406,36 @@ def test_bump_template_extra_quotes(
1406
1406
1407
1407
changelog = project_root / any_changelog_format .default_changelog_file
1408
1408
assert changelog .read_text () == "no-quote - single quotes - double quotes"
1409
+
1410
+
1411
+ def test_bump_changelog_contains_increment_only (mocker , tmp_commitizen_project , capsys ):
1412
+ """Issue 1024"""
1413
+ # Initialize commitizen up to v1.0.0
1414
+ project_root = Path (tmp_commitizen_project )
1415
+ tmp_commitizen_cfg_file = project_root / "pyproject.toml"
1416
+ tmp_commitizen_cfg_file .write_text (
1417
+ "[tool.commitizen]\n " 'version="1.0.0"\n ' "update_changelog_on_bump = true\n "
1418
+ )
1419
+ tmp_changelog_file = project_root / "CHANGELOG.md"
1420
+ tmp_changelog_file .write_text ("## v1.0.0" )
1421
+ create_file_and_commit ("feat(user): new file" )
1422
+ create_tag ("v1.0.0" )
1423
+
1424
+ # Add a commit and bump to v2.0.0
1425
+ create_file_and_commit ("feat(user)!: new file" )
1426
+ testargs = ["cz" , "bump" , "--yes" ]
1427
+ mocker .patch .object (sys , "argv" , testargs )
1428
+ cli .main ()
1429
+ _ = capsys .readouterr ()
1430
+
1431
+ # Add a commit and create the incremental changelog to v3.0.0
1432
+ # it should only include v3 changes
1433
+ create_file_and_commit ("feat(next)!: next version" )
1434
+ testargs = ["cz" , "bump" , "--yes" , "--files-only" , "--changelog-to-stdout" ]
1435
+ mocker .patch .object (sys , "argv" , testargs )
1436
+ with pytest .raises (ExpectedExit ):
1437
+ cli .main ()
1438
+ out , _ = capsys .readouterr ()
1439
+
1440
+ assert "3.0.0" in out
1441
+ assert "2.0.0" not in out
0 commit comments