Skip to content

Introduce generic version class

Fabien Catteau requested to merge new-version-class into v3

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?

Edited by Fabien Catteau

Merge request reports