Support old and new git release tag formats#53715
Support old and new git release tag formats#53715christopherfujino merged 24 commits intoflutter:masterfrom
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.
Removing this as from this point forward, upgrades will be possible with mere fast forward.
| 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.
Is there a point in time where it would be safe to remove the old tag parsing logic? If so, lets file an issue
| } | ||
| 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.
why did this change to 6?
There was a problem hiding this comment.
Oops, bad copy and paste, fixed.
| <String>['git', 'tag', '-l', '*.*.*', '--sort=-creatordate'], | ||
| throwOnError: true, | ||
| workingDirectory: Cache.flutterRoot, | ||
| ); |
There was a problem hiding this comment.
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.
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.
Yeah, removing the reference to git not being installed sgtm.
| /// 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.
Is it supposed to be possible to have both a +hotfix and a -dev?
There was a problem hiding this comment.
you're right, i took out the hotfix from this regex pattern
| }); | ||
|
|
||
| tearDown(() { | ||
| //print('Investigate ${parentDirectory.path}'); |
There was a problem hiding this comment.
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.
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.
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].