From fea572016106e079a8c548cf2be99fbc6c36cdb2 Mon Sep 17 00:00:00 2001 From: bom Date: Wed, 22 Feb 2023 10:57:42 +0100 Subject: [PATCH] Return version objects instead of mutating --- version.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/version.py b/version.py index 6439195..61d92f5 100644 --- a/version.py +++ b/version.py @@ -36,10 +36,14 @@ class Version(): return self.version_string def create_release_version(self): - if self.release_type == ReleaseType.PATCH: - self.is_snapshot = False - else: - self.increment() + release_version = Version(self.version_list, self.release_type) + release_version.is_snapshot = self.is_snapshot + release_version.increment() + return release_version def create_bump_version(self): - self.increment(ReleaseType.BUMP) + bump_version = Version(self.version_list, self.release_type) + bump_version.is_snapshot = self.is_snapshot + bump_version.release_type = ReleaseType.BUMP + bump_version.increment() + return bump_version