From ca5182d08982c3c521fb8ac6471270da22ab9117 Mon Sep 17 00:00:00 2001 From: Unai Martinez-Corral Date: Sat, 11 Mar 2023 17:54:44 +0100 Subject: [PATCH 1/3] build: do not echo 'Removing...' if the files are to be kept --- src/towncrier/build.py | 2 +- src/towncrier/newsfragments/487.misc | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 src/towncrier/newsfragments/487.misc diff --git a/src/towncrier/build.py b/src/towncrier/build.py index 3518940d..19c4c6a1 100644 --- a/src/towncrier/build.py +++ b/src/towncrier/build.py @@ -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) diff --git a/src/towncrier/newsfragments/487.misc b/src/towncrier/newsfragments/487.misc new file mode 100644 index 00000000..e34ea6b0 --- /dev/null +++ b/src/towncrier/newsfragments/487.misc @@ -0,0 +1 @@ +Do not echo 'Removing...' if the files are to be kept \ No newline at end of file From 8e259fdcfafc41fc8162f27b47c4df2b159e1cff Mon Sep 17 00:00:00 2001 From: Unai Martinez-Corral <38422348+umarcor@users.noreply.github.com> Date: Tue, 21 Mar 2023 11:22:49 +0100 Subject: [PATCH 2/3] build: check if fragment_filenames is empty Co-authored-by: Chris Beaven --- src/towncrier/build.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/towncrier/build.py b/src/towncrier/build.py index 19c4c6a1..ebe75e90 100644 --- a/src/towncrier/build.py +++ b/src/towncrier/build.py @@ -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:") From dab37b5eab28f073bb2351220860ca04582a8602 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Apr 2023 14:38:30 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/towncrier/newsfragments/487.misc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/towncrier/newsfragments/487.misc b/src/towncrier/newsfragments/487.misc index e34ea6b0..ddbc7205 100644 --- a/src/towncrier/newsfragments/487.misc +++ b/src/towncrier/newsfragments/487.misc @@ -1 +1 @@ -Do not echo 'Removing...' if the files are to be kept \ No newline at end of file +Do not echo 'Removing...' if the files are to be kept