Introduce generic version class
What does this MR do?
Introduce generic version class.
- A version has an array of
tokens
. - Tokens might be integers, strings, or anything else.
- A version might have
addition
. - Additions might be pre-release tags, sub-versions, etc.
Version
includes the Comparable
module and implements <=>
.
To compare versions, <=>
first compares tokens sequentially using compare_token_pair
.
If all tokens are equals, then it compares the additions.
If only one of the versions being compared has an addition,
then it gets an empty addition that can be compared to the one we have.
What are the relevant issue numbers?
gitlab-org/gitlab#386070 (comment 1821312900)
Does this MR meet the acceptance criteria?
-
Changelog entry added -
Documentation created/updated for this project, if necessary -
Tests added for this feature/bug -
Conforms to the code review guidelines -
Security reports checked/validated by reviewer
Edited by Fabien Catteau