Skip to content

Commit

Permalink
build: do not echo 'Removing...' if the files are to be kept (#487)
Browse files Browse the repository at this point in the history
* build: do not echo 'Removing...' if the files are to be kept

* build: check if fragment_filenames is empty

Co-authored-by: Chris Beaven <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Chris Beaven <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Hynek Schlawack <[email protected]>
  • Loading branch information
4 people authored Apr 5, 2023
1 parent c97fe32 commit 6ecff4f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/towncrier/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,12 @@ def __main(
click.echo("Staging newsfile...", err=to_err)
_git.stage_newsfile(base_directory, news_file)

click.echo("Removing news fragments...", err=to_err)
if should_remove_fragment_files(
fragment_filenames,
answer_yes,
answer_keep,
):
click.echo("Removing news fragments...", err=to_err)
_git.remove_files(fragment_filenames)

click.echo("Done!", err=to_err)
Expand All @@ -279,6 +279,9 @@ def should_remove_fragment_files(
answer_yes: bool,
answer_keep: bool,
) -> bool:
if not fragment_filenames:
click.echo("No news fragments to remove. Skipping!")
return False
try:
if answer_keep:
click.echo("Keeping the following files:")
Expand Down
1 change: 1 addition & 0 deletions src/towncrier/newsfragments/487.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Do not echo 'Removing...' if the files are to be kept

0 comments on commit 6ecff4f

Please sign in to comment.