Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix prerelease version handling in next_major, next_minor, and next_patch methods #151

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/univers/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,19 @@ def build(self):
return self.value and self.value.build

def next_major(self):
return self.value and SemverVersion(str(self.value.next_major()))
if self.prerelease:
return SemverVersion(f"{self.major + 1}.0.0")
return SemverVersion(str(self.value.next_major()))

def next_minor(self):
return self.value and SemverVersion(str(self.value.next_minor()))
if self.prerelease:
return SemverVersion(f"{self.major}.{self.minor + 1}.0")
return SemverVersion(str(self.value.next_minor()))

def next_patch(self):
return self.value and SemverVersion(str(self.value.next_patch()))
if self.prerelease:
return SemverVersion(f"{self.major}.{self.minor}.{self.patch}")
return SemverVersion(str(self.value.next_patch()))


def is_even(s):
Expand Down