-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Support old and new git release tag formats #53715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support old and new git release tag formats #53715
Conversation
…st to support both
|
It might be simpler to try to parse it twice - once using the old regexp and one using the new. And then to add new fields to the |
| } | ||
| } | ||
|
|
||
| /// Attempts to reset to the last non-hotfix tag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing this as from this point forward, upgrades will be possible with mere fast forward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woot!
| 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]+)$'); | ||
| /// Check for the release tag format pre-v1.17.0 | ||
| static GitTagVersion parseFirstVersion(String version) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a point in time where it would be safe to remove the old tag parsing logic? If so, lets file an issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, filed #53850 to track.
| } | ||
| final List<int> parsedParts = parts.take(5).map<int>((String source) => source == null ? null : int.tryParse(source)).toList(); | ||
| return GitTagVersion(parsedParts[0], parsedParts[1], parsedParts[2], parsedParts[3], parsedParts[4], parts[5]); | ||
| final List<int> parsedParts = parts.take(6).map<int>((String source) => source == null ? null : int.tryParse(source)).toList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did this change to 6?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, bad copy and paste, fixed.
jonahwilliams
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| <String>['git', 'tag', '-l', '*.*.*', '--sort=-creatordate'], | ||
| throwOnError: true, | ||
| workingDirectory: Cache.flutterRoot, | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the toolExit below. If git is not installed, I think the exception would be an ArgumentError and not a ProcessException.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the action point be to remove the reference to git not being installed? I was gonna check if git canRun, but then i realize if they don't have git installed they'll never get to this point, as it would fail earlier.
in terms of how to handle the case of the user not having git installed, I'm planning to address this for #52262
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, removing the reference to git not being installed sgtm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| /// Check for the release tag format from v1.17.0 on | ||
| static GitTagVersion parseSecondVersion(String version) { | ||
| final RegExp versionPattern = RegExp( | ||
| r'^([0-9]+)\.([0-9]+)\.([0-9]+)(?:\+hotfix\.([0-9]+))?(-dev\.[0-9]+\.[0-9]+)?-([0-9]+)-g([a-f0-9]+)$'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it supposed to be possible to have both a +hotfix and a -dev?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right, i took out the hotfix from this regex pattern
| }); | ||
|
|
||
| tearDown(() { | ||
| //print('Investigate ${parentDirectory.path}'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leftover debug print?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, removed.
| } | ||
|
|
||
| /// Check for the release tag format from v1.17.0 on | ||
| static GitTagVersion parseSecondVersion(String version) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming bikeshed: maybe call this parseVersion() and the other one parseLegacyVersion()? Or feel free to ignore so you don't have to start tests over again just for a naming commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to kick the tests off again anyway, so I applied this change.
|
Firebase test lab failure looks to be infra related, following up in infra chat. |
* Support old and new git release tag formats (#53715) * Improve downgrade-upgrade integration test (#53775) * Fix diagnostics crash in profile mode (#53878) * Prevent diagnostics crash in profile mode * Prevent diagnostics crash in profile mode Co-authored-by: Christopher Fujino <[email protected]> Co-authored-by: Ferhat <[email protected]>
Description
Update the flutter version determination logic to support both old and new tag formats. NOTE: #53775 was landed before this as part of the fix.
Old Tags
v1.2.3v1.2.3+hotfix.1New Tags
1.2.31.2.3-dev.4.5Related Issues
Fixes #53688
Tests
Updated existing unit test to verify both old and new style tag format.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read [Handling breaking changes].