From 35b609dd8b75f8b443b5ce17f1cec18162d8ab42 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 21 Jun 2018 17:27:01 -0400 Subject: [PATCH] Allow writing commit with version bump --- script/version_bump.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/script/version_bump.py b/script/version_bump.py index 59060a7075b..eb61420a600 100755 --- a/script/version_bump.py +++ b/script/version_bump.py @@ -2,6 +2,7 @@ """Helper script to bump the current version.""" import argparse import re +import subprocess from packaging.version import Version @@ -117,12 +118,20 @@ def main(): help="The type of the bump the version to.", choices=['beta', 'dev', 'patch', 'minor'], ) + parser.add_argument( + '--commit', action='store_true', + help='Create a version bump commit.') arguments = parser.parse_args() current = Version(const.__version__) bumped = bump_version(current, arguments.type) assert bumped > current, 'BUG! New version is not newer than old version' write_version(bumped) + if not arguments.commit: + return + + subprocess.run(['git', 'commit', '-am', f'Bumped version to {bumped}']) + def test_bump_version(): """Make sure it all works."""