Unverified Commit eb996afa authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

make hotfix use a plus instead of minus (#32060)

parent 2f1e7cf6
...@@ -572,7 +572,7 @@ class GitTagVersion { ...@@ -572,7 +572,7 @@ class GitTagVersion {
/// The Z in vX.Y.Z. /// The Z in vX.Y.Z.
final int z; final int z;
/// the F in vX.Y.Z-hotfix.F /// the F in vX.Y.Z+hotfix.F
final int hotfix; final int hotfix;
/// Number of commits since the vX.Y.Z tag. /// Number of commits since the vX.Y.Z tag.
...@@ -586,7 +586,7 @@ class GitTagVersion { ...@@ -586,7 +586,7 @@ class GitTagVersion {
} }
static GitTagVersion parse(String version) { static GitTagVersion parse(String version) {
final RegExp versionPattern = RegExp(r'^v([0-9]+)\.([0-9]+)\.([0-9]+)(?:-hotfix\.([0-9]+))?-([0-9]+)-g([a-f0-9]+)$'); final RegExp versionPattern = RegExp(r'^v([0-9]+)\.([0-9]+)\.([0-9]+)(?:\+hotfix\.([0-9]+))?-([0-9]+)-g([a-f0-9]+)$');
final List<String> parts = versionPattern.matchAsPrefix(version)?.groups(<int>[1, 2, 3, 4, 5, 6]); final List<String> parts = versionPattern.matchAsPrefix(version)?.groups(<int>[1, 2, 3, 4, 5, 6]);
if (parts == null) { if (parts == null) {
printTrace('Could not interpret results of "git describe": $version'); printTrace('Could not interpret results of "git describe": $version');
...@@ -601,11 +601,11 @@ class GitTagVersion { ...@@ -601,11 +601,11 @@ class GitTagVersion {
return '0.0.0-unknown'; return '0.0.0-unknown';
if (commits == 0) { if (commits == 0) {
if (hotfix != null) if (hotfix != null)
return '$x.$y.$z-hotfix.$hotfix'; return '$x.$y.$z+hotfix.$hotfix';
return '$x.$y.$z'; return '$x.$y.$z';
} }
if (hotfix != null) if (hotfix != null)
return '$x.$y.$z-hotfix.${hotfix + 1}-pre.$commits'; return '$x.$y.$z+hotfix.${hotfix + 1}-pre.$commits';
return '$x.$y.${z + 1}-pre.$commits'; return '$x.$y.${z + 1}-pre.$commits';
} }
} }
......
...@@ -394,8 +394,8 @@ void main() { ...@@ -394,8 +394,8 @@ void main() {
expect(GitTagVersion.parse('v1.2.3-4-g$hash').frameworkVersionFor(hash), '1.2.4-pre.4'); expect(GitTagVersion.parse('v1.2.3-4-g$hash').frameworkVersionFor(hash), '1.2.4-pre.4');
expect(GitTagVersion.parse('v98.76.54-32-g$hash').frameworkVersionFor(hash), '98.76.55-pre.32'); expect(GitTagVersion.parse('v98.76.54-32-g$hash').frameworkVersionFor(hash), '98.76.55-pre.32');
expect(GitTagVersion.parse('v10.20.30-0-g$hash').frameworkVersionFor(hash), '10.20.30'); expect(GitTagVersion.parse('v10.20.30-0-g$hash').frameworkVersionFor(hash), '10.20.30');
expect(GitTagVersion.parse('v1.2.3-hotfix.1-4-g$hash').frameworkVersionFor(hash), '1.2.3-hotfix.2-pre.4'); expect(GitTagVersion.parse('v1.2.3+hotfix.1-4-g$hash').frameworkVersionFor(hash), '1.2.3+hotfix.2-pre.4');
expect(GitTagVersion.parse('v7.2.4-hotfix.8-0-g$hash').frameworkVersionFor(hash), '7.2.4-hotfix.8'); expect(GitTagVersion.parse('v7.2.4+hotfix.8-0-g$hash').frameworkVersionFor(hash), '7.2.4+hotfix.8');
expect(testLogger.traceText, ''); expect(testLogger.traceText, '');
expect(GitTagVersion.parse('x1.2.3-4-g$hash').frameworkVersionFor(hash), '0.0.0-unknown'); expect(GitTagVersion.parse('x1.2.3-4-g$hash').frameworkVersionFor(hash), '0.0.0-unknown');
expect(GitTagVersion.parse('v1.0.0-unknown-0-g$hash').frameworkVersionFor(hash), '0.0.0-unknown'); expect(GitTagVersion.parse('v1.0.0-unknown-0-g$hash').frameworkVersionFor(hash), '0.0.0-unknown');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment