Fix previous_minor method of ReleaseToos::Version
What does this MR do and why?
Describe in detail what your merge request does and why.
Content
Fix previous_minor method of ReleaseToos::Version
- Return a minor version string, instead of full string with the patch number, e.g. 17.10 instead of 17.10.0
- In case of a major version (e.g. 18.0), use
GitlabReleasesGemClient.previous_minorsto determine. This logic is more reliable than the version server, which may have the version order wrong.
Regrading the removal of ".0" at the end of the version string, I checked and found previous_minor used only with the Version class, which handles it well:
[1] pry(main)> ReleaseTools::Version.new('17.10')
=> "17.10.0"
[3] pry(main)> ReleaseTools::Version.new('17.10').stable_branch(ee: true)
=> "17-10-stable-ee"
Testing
[3] pry(main)> ReleaseTools::GitlabReleasesGemClient.previous_minors('17.11')
=> ["17.11", "17.10", "17.9"]
[1] pry(main)> ReleaseTools::Version.new('18.0.0').previous_minor
=> "17.11"
Edited by Dat Tang