mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
make hotfix use a plus instead of minus (#32060)
This commit is contained in:
parent
2f1e7cf662
commit
eb996afaa8
@ -572,7 +572,7 @@ class GitTagVersion {
|
||||
/// The Z in vX.Y.Z.
|
||||
final int z;
|
||||
|
||||
/// the F in vX.Y.Z-hotfix.F
|
||||
/// the F in vX.Y.Z+hotfix.F
|
||||
final int hotfix;
|
||||
|
||||
/// Number of commits since the vX.Y.Z tag.
|
||||
@ -586,7 +586,7 @@ class GitTagVersion {
|
||||
}
|
||||
|
||||
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]);
|
||||
if (parts == null) {
|
||||
printTrace('Could not interpret results of "git describe": $version');
|
||||
@ -601,11 +601,11 @@ class GitTagVersion {
|
||||
return '0.0.0-unknown';
|
||||
if (commits == 0) {
|
||||
if (hotfix != null)
|
||||
return '$x.$y.$z-hotfix.$hotfix';
|
||||
return '$x.$y.$z+hotfix.$hotfix';
|
||||
return '$x.$y.$z';
|
||||
}
|
||||
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';
|
||||
}
|
||||
}
|
||||
|
||||
@ -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('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('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('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(testLogger.traceText, '');
|
||||
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');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user