From 8454d3fe879c112f9d0e15fe2d5a31fd892f1fe9 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Thu, 14 Oct 2021 15:01:17 +0200 Subject: [PATCH 1/4] Add next to the bump script --- scripts/bump-version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/bump-version.py b/scripts/bump-version.py index 551d01b89..2607f3f34 100644 --- a/scripts/bump-version.py +++ b/scripts/bump-version.py @@ -9,7 +9,7 @@ from jupyter_releaser.util import is_prerelease, get_version, run -OPTIONS = ["major", "minor", "release", "build"] +OPTIONS = ["major", "minor", "release", "build", "next"] def patch(force=False): From 0cd4e8af379716c9c1a617f612dc53caf995e316 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Thu, 14 Oct 2021 18:29:57 +0200 Subject: [PATCH 2/4] Check version spec first --- scripts/bump-version.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/bump-version.py b/scripts/bump-version.py index 2607f3f34..f4e8ee94b 100644 --- a/scripts/bump-version.py +++ b/scripts/bump-version.py @@ -36,10 +36,6 @@ def patch(force=False): def update(spec, force=False): prev = get_version() - # Make sure we have a valid version spec. - if spec not in OPTIONS: - raise Exception(f"Version spec must be one of: {OPTIONS}") - is_final = not is_prerelease(prev) if is_final and spec == "release": @@ -94,6 +90,10 @@ def bump(force, spec): if len(status) > 0: raise Exception("Must be in a clean git state with no untracked files") + # Make sure we have a valid version spec. + if spec not in OPTIONS: + raise Exception(f"Version spec must be one of: {OPTIONS}") + prev = get_version() is_final = not is_prerelease(prev) if spec == "next": From 1997f1f826c00bed7822b176dc03677bdf1a8b6b Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Thu, 14 Oct 2021 18:30:48 +0200 Subject: [PATCH 3/4] Add patch --- scripts/bump-version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/bump-version.py b/scripts/bump-version.py index f4e8ee94b..026115583 100644 --- a/scripts/bump-version.py +++ b/scripts/bump-version.py @@ -9,7 +9,7 @@ from jupyter_releaser.util import is_prerelease, get_version, run -OPTIONS = ["major", "minor", "release", "build", "next"] +OPTIONS = ["major", "minor", "release", "build", "patch", "next"] def patch(force=False): From f166a09d551c8a2e371346ab5f0058a1b3c979fe Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Thu, 14 Oct 2021 20:45:42 +0200 Subject: [PATCH 4/4] Raise a ValueError on wrong option Co-authored-by: Duc Trung LE --- scripts/bump-version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/bump-version.py b/scripts/bump-version.py index 026115583..bf06dcec8 100644 --- a/scripts/bump-version.py +++ b/scripts/bump-version.py @@ -92,7 +92,7 @@ def bump(force, spec): # Make sure we have a valid version spec. if spec not in OPTIONS: - raise Exception(f"Version spec must be one of: {OPTIONS}") + raise ValueError(f"Version spec must be one of: {OPTIONS}") prev = get_version() is_final = not is_prerelease(prev)