Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0801ee2

Browse files
authored
Merge pull request commitizen-tools#623 from gsalvatella/fix/tag-format
fix(changelog): allow rev range lookups without a tag format
2 parents c07c147 + d570be1 commit 0801ee2

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

‎commitizen/commands/changelog.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def __call__(self):
137137
)
138138
start_rev = self._find_incremental_rev(latest_tag_version, tags)
139139

140-
if self.rev_rangeandself.tag_format:
140+
if self.rev_range:
141141
start_rev, end_rev = changelog.get_oldest_and_newest_rev(
142142
tags,
143143
version=self.rev_range,

‎tests/commands/test_changelog_command.py‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,37 @@ def test_changelog_from_rev_single_version_not_found(
659659
assert "Could not find a valid revision" in str(excinfo)
660660

661661

662+
@pytest.mark.usefixtures("tmp_commitizen_project")
663+
@pytest.mark.freeze_time("2022年02月13日")
664+
def test_changelog_from_rev_range_default_tag_format(
665+
mocker, config_path, changelog_path
666+
):
667+
"""Checks that rev_range is calculated with the default (None) tag format"""
668+
# create commit and tag
669+
create_file_and_commit("feat: new file")
670+
testargs = ["cz", "bump", "--yes"]
671+
mocker.patch.object(sys, "argv", testargs)
672+
cli.main()
673+
wait_for_tag()
674+
675+
create_file_and_commit("feat: after 0.2.0")
676+
create_file_and_commit("feat: another feature")
677+
678+
testargs = ["cz", "bump", "--yes"]
679+
mocker.patch.object(sys, "argv", testargs)
680+
cli.main()
681+
wait_for_tag()
682+
683+
testargs = ["cz", "changelog", "0.3.0"]
684+
mocker.patch.object(sys, "argv", testargs)
685+
cli.main()
686+
687+
with open(changelog_path, "r") as f:
688+
out = f.read()
689+
690+
assert "new file" not in out
691+
692+
662693
@pytest.mark.usefixtures("tmp_commitizen_project")
663694
@pytest.mark.freeze_time("2022年02月13日")
664695
def test_changelog_from_rev_range_version_not_found(mocker, config_path):

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /