@@ -36,6 +36,7 @@ This specification describes _orderable_ and _non-orderable_ product version str
3636Orderable version strings fall into one of 4 version types as defined by a category (release or release candidate)
3737and whether it is a snapshot version or not (snapshot versions contain a commit hash at the end), the cross section
3838of which produces the following:
39+
3940 ```
4041Version Type Example Format
4142------------ ------- ------
@@ -58,52 +59,52 @@ decisions about forward-vs-backwards product migrations. Further, it simplifies
5859via version ranges; for instance, a product may declare that it is compatible with a second product with a version in
5960` [1.2.3, 2.0.0) ` .
6061
61- For any two orderable versions, v1 and v2 , we can define whether v1 is a * bigger * (equivalently, * later* , * newer* , etc)
62- than v2 . For the four variants, there can be up to three numeric components identifying a version. From left to right,
63- they are: the usual notation of the base version (e.g., for ` 1.2.3 ` , 1=major, 2=minor, 3=patch), an optional second
62+ For any two orderable versions, ` v1 ` and ` v2 ` , we can define whether ` v1 ` is a * larger * (equivalently, * later* , * newer* , etc)
63+ than ` v2 ` . For the four variants, there can be up to three numeric components identifying a version. From left to right,
64+ they are: the usual notation of the base version (e.g., for ` 1.2.3 ` , 1=major, 2=minor, 3=patch), an optional first
6465numeric component to identify a release candidate (e.g. ` -rc3 ` ) or a snapshot version (e.g. ` -5-gnm4s9ba ` ), and finally
65- an optional third numeric component to identify a release candidate snapshot version (e.g. ` -rc3-5-gnm4s9ba ` ).
66+ an optional second numeric component to identify a release candidate snapshot version (e.g. ` -rc3-5-gnm4s9ba ` ).
67+
68+ Intuitively, the version types define an ordering of versions for a given base version:
69+ - For a given base version, release snapshot versions are larger than release versions
70+ - For a given base version, release versions are larger than release candidate and release candidate snapshot versions
71+ - For a given base and rc version, release candidate snapshot versions are larger than release candidate versions
6672
67- Intuitively, given the same base version, snapshot versions are bigger than non-snapshot versions, normal release
68- versions are bigger than release candidate versions, and a normal release snapshot version is bigger than a release
69- candidate of any kind. The following top-down procedure determines whether v1 is bigger than v2, written ` v1 > v2 ` ;
73+ The following top-down procedure determines whether ` v1 ` is larger than ` v2 ` , written ` v1 > v2 ` ;
7074comparisons like ` major(v1) > major(v2) ` are by integer ordering (not lexicographic ordering):
7175
72- - If ` major(v1) > major(v2) ` , then ` v1 > v2 `
73- - If ` minor(v1) > minor(v2) ` , then ` v1 > v2 `
74- - If ` patch(v1) > patch(v2) ` , then ` v1 > v2 `
75- - From here on, let us assume that the base versions (major/minor/patch) are the same for v1 and v2
76- - If v1 is a normal snapshot version and v2 is a normal release, then ` v1 > v2 `
77- - If v1 is a normal release version and v2 is a rc version, then ` v1 > v2 `
78- - If v1 and v2 are both normal snapshot versions and ` snapshot(v1) > snapshot(v2) ` , then ` v1 > v2 `
79- - If v1 and v2 are both rc versions and ` rc(v1) > rc(v2) ` , then ` v1 > v2 `
80- - From here on, let us assume that v1 and v2 are both rc versions of the same ` rc() ` number
81- - If v1 is a snapshot rc version and v2 is a normal rc version, then ` v1 > v2 `
82- - If v1 and v2 are both snapshot rc versions and ` rcSnapshot(v1) > rcSnapshot(v2) ` , then ` v1 > v2 `
83-
84- Further, v1 is as big as v2, written ` v1 == v2 ` , iff neither ` v1 > v2 ` nor ` v2 > v1 ` .
85- We write ` v1 >= v2 ` if ` v1 > v2 ` or ` v1 == v2 ` .
76+ - We know nothing about ` v1 ` and ` v2 ` :
77+ - If ` major(v1) > major(v2) ` , then ` v1 > v2 `
78+ - If ` minor(v1) > minor(v2) ` , then ` v1 > v2 `
79+ - If ` patch(v1) > patch(v2) ` , then ` v1 > v2 `
80+ - From here on, we know that ` v1 ` and ` v2 ` have the same base version:
81+ - If both ` v1 ` and ` v2 ` are both release snapshot versions and ` snapshot(v1) > snapshot(v2) ` , then ` v1 > v2 `
82+ - If ` v1 ` is a release snapshot version and ` v2 ` is not, then ` v1 > v2 `
83+ - If both ` v1 ` and ` v2 ` are both release versions, then ` v1 == v2 `
84+ - If ` v1 ` is a release version and ` v2 ` is not, then ` v1 > v2 `
85+ - From here on, we know that ` v1 ` and ` v2 ` have the same base version and are release candidate or release candidate snapshot version:
86+ - If ` rc(v1) > rc(v2) ` , then ` v1 > v2 `
87+ - If ` v1 ` is a release candidate snapshot version and ` v2 ` is not, then ` v1 > v2 `
88+ - If ` rcSnapshot(v1) > rcSnapshot(v2) ` , then ` v1 > v2 `
8689
8790Examples, with each greater than all the previous:
88- - RC: ` 1.0.0-rc1 `
89- - Bigger RC: ` 1.0.0-rc2 `
90- - RC Snapshot trumps RC: ` 1.0.0-rc2-4-gaaaaaaa `
91- - Bigger RC Snapshot: ` 1.0.0-rc2-5-gccccccc `
92- - Base trumps RC: ` 2.0.0 `
93- - Snapshot trumps all: ` 2.0.0-3-gaaaaaaa `
94- - Bigger Snapshot: ` 2.0.0-4-gbbbbbbb `
95- - Bigger Base: ` 2.1.0-rc1 `
96- - Release trumps RC: ` 2.1.0 `
91+ - ` 1.0.0-rc1 `
92+ - ` 1.0.0-rc1-1-gabcedf `
93+ - ` 1.0.0-rc1-2-gabcedf `
94+ - ` 1.0.0-rc2 `
95+ - ` 1.0.0 `
96+ - ` 1.0.0-1-gabcedf `
97+ - ` 1.0.0-2-gabcedf `
98+ - ` 1.0.1-rc1 `
99+ - ` 1.0.1 `
100+ - ` 1.1.0 `
101+ - ` 2.0.0 `
97102
98103Examples of equality:
99- - ` 1.2.0 == 1.2.0 `
100- - ` 2.0.0-rc1 == 2.0.0-rc1 `
101- - ` 2.0.0-rc1-3-gaaaaaaa == 2.0.0-rc1-3-gbbbbbbb `
102- - ` 2.0.0-5-gbbbbbbb == 2.0.0-5-gaaaaaaa1 `
103-
104- Note that any two release and rc versions are equally big iff they are syntactically equal. As the second example
105- demonstrates, this does not hold for snapshot versions.
106-
104+ - ` 1.0.0-rc1 == 1.0.0-rc1 `
105+ - ` 1.0.0-rc1-1-gaaaaaaa == 1.0.0-rc1-1-gbbbbbbb `
106+ - ` 1.0.0 == 1.0.0 `
107+ - ` 1.0.0-1-gaaaaaaa == 1.0.0-1-gbbbbbbb `
107108
108109#### Version matchers
109110
0 commit comments