From 2b40474d447f9329f97bbf43c96246018415fba7 Mon Sep 17 00:00:00 2001 From: Andrew Aldridge Date: Mon, 23 Sep 2019 15:05:27 -0400 Subject: [PATCH] Fix the bump_version script's changelog mutation --- HACKING.md | 3 ++- tools/bump_version.py | 2 +- tools/test_bump_version.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/HACKING.md b/HACKING.md index fd90dff5..308e0456 100644 --- a/HACKING.md +++ b/HACKING.md @@ -136,7 +136,8 @@ To release snooty, do the following: in the `dist` directory, and check the _This is a pre-release_ checkbox. If there is an error, use `git reset --hard ` to revert any -commits that might have been made. +commits that might have been made, and `git tag --delete v` to remove the +tag if it was created. ## Problem Areas diff --git a/tools/bump_version.py b/tools/bump_version.py index fe26b5b2..122f9be7 100755 --- a/tools/bump_version.py +++ b/tools/bump_version.py @@ -44,7 +44,7 @@ def release_changelog(version: str, text: str) -> str: def replace(match: Match[str]) -> str: unreleased_block = match["unreleased"].strip() - return f"\n## [Unreleased]\n\n## [{version}] - {date_string}\n\n{unreleased_block}\n" + return f"\n## [Unreleased]\n\n## [v{version}] - {date_string}\n\n{unreleased_block}\n" result = CHANGELOG_UNRELEASED_PAT.sub(replace, text) if not result: diff --git a/tools/test_bump_version.py b/tools/test_bump_version.py index 246cf4ef..cce603e5 100644 --- a/tools/test_bump_version.py +++ b/tools/test_bump_version.py @@ -31,7 +31,7 @@ def test_release_changelog() -> None: - No longer create spurious diagnostics about including apiargs artifacts and `hash.rst`.""" assert ( - release_changelog("v0.1.13", TEST_INPUT1) + release_changelog("0.1.13", TEST_INPUT1) == f"""# Changelog ## [Unreleased]