@@ -1406,3 +1406,38 @@ 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 "
1418
+ 'version="1.0.0"\n '
1419
+ "update_changelog_on_bump = true\n "
1420
+ )
1421
+ tmp_changelog_file = project_root / "CHANGELOG.md"
1422
+ tmp_changelog_file .write_text ("## v1.0.0" )
1423
+ create_file_and_commit ("feat(user): new file" )
1424
+ create_tag ("v1.0.0" )
1425
+
1426
+ # Add a commit and bump to v2.0.0
1427
+ create_file_and_commit ("feat(user)!: new file" )
1428
+ testargs = ["cz" , "bump" , "--yes" ]
1429
+ mocker .patch .object (sys , "argv" , testargs )
1430
+ cli .main ()
1431
+ _ = capsys .readouterr ()
1432
+
1433
+ # Add a commit and create the incremental changelog to v3.0.0
1434
+ # it should only include v3 changes
1435
+ create_file_and_commit ("feat(next)!: next version" )
1436
+ testargs = ["cz" , "bump" , "--yes" , "--files-only" , "--changelog-to-stdout" ]
1437
+ mocker .patch .object (sys , "argv" , testargs )
1438
+ with pytest .raises (ExpectedExit ):
1439
+ cli .main ()
1440
+ out , _ = capsys .readouterr ()
1441
+
1442
+ assert "3.0.0" in out
1443
+ assert "2.0.0" not in out
0 commit comments