Handle other rc cases

The new-release script couldnt handle cases where we wanted to
increment the version for an rc where there hadn't previously been
a release since milestones aren't as much of a thing anymore.

This patch will add the ability to detect and handle these cases
falling back to how things are done with milestones.

Change-Id: I7c7d6ad76c0b3f9aae41a45f2cd646e298966c6f
This commit is contained in:
Kendall Nelson 2019-03-14 17:49:19 -07:00
parent 480462fcec
commit cb1e9ddb2f

View File

@ -85,9 +85,15 @@ def increment_milestone_version(old_version, release_type):
if 'b' in old_version[-1]:
# First RC
new_version_parts.append('0rc1')
else:
elif 'rc' in old_version[-1]:
# A deliverable exists so we can handle normally
next_rc = int(old_version[-1][3:]) + 1
new_version_parts.append('0rc{}'.format(next_rc))
else:
# No milestone or rc exists, fallback to the same logic
# as for '0b1' and increment the major version.
new_version_parts = increment_version(old_version, (1, 0, 0))
new_version_parts.append('0rc1')
else:
raise ValueError('Unknown release type {!r}'.format(release_type))
return new_version_parts