diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2016-02-12 00:41:09 +0100 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2016-02-12 00:41:09 +0100 |
commit | c321d091d9754bc0d3692864f6f1e594136ef429 (patch) | |
tree | f55f61c25fc08ba61f970c08d2402e66e11a6426 /semantic_version | |
parent | f74de67a9a476114370292691ac709109269ddbb (diff) | |
parent | 9a1144034f81ffa76b9e00ac9220f8c024dba1ab (diff) | |
download | semantic-version-c321d091d9754bc0d3692864f6f1e594136ef429.tar.gz |
Merge branch 'bump-version-2' of https://github.com/MinchinWeb/python-semanticversion into MinchinWeb-bump-version-2
Diffstat (limited to 'semantic_version')
-rw-r--r-- | semantic_version/base.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/semantic_version/base.py b/semantic_version/base.py index 982fcc8..619a113 100644 --- a/semantic_version/base.py +++ b/semantic_version/base.py @@ -89,15 +89,24 @@ class Version(object): return int(value) def next_major(self): - return Version('.'.join(str(x) for x in [self.major + 1, 0, 0])) + if self.prerelease and self.minor is 0 and self.patch is 0: + return Version('.'.join(str(x) for x in [self.major, self.minor, self.patch])) + else: + return Version('.'.join(str(x) for x in [self.major + 1, 0, 0])) def next_minor(self): - return Version( - '.'.join(str(x) for x in [self.major, self.minor + 1, 0])) + if self.prerelease and self.patch is 0: + return Version('.'.join(str(x) for x in [self.major, self.minor, self.patch])) + else: + return Version( + '.'.join(str(x) for x in [self.major, self.minor + 1, 0])) def next_patch(self): - return Version( - '.'.join(str(x) for x in [self.major, self.minor, self.patch + 1])) + if self.prerelease: + return Version('.'.join(str(x) for x in [self.major, self.minor, self.patch])) + else: + return Version( + '.'.join(str(x) for x in [self.major, self.minor, self.patch + 1])) @classmethod def coerce(cls, version_string, partial=False): |