-
Notifications
You must be signed in to change notification settings - Fork 29.8k
[flutter_tools] enable flutter upgrade to support force pushed branches
#55594
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
Conversation
…he upstream branch
| @required bool testFlow, | ||
| }) async { | ||
| await verifyUpstreamConfigured(); | ||
| final String upstreamRevision = await fetchRemoteRevision(); |
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 know we used to have this check, could you remind me of the reason we added? Is there git console spam on no-op upgrades otherwise?
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 think before, we never grabbed the revision that we wanted to upgrade to, so the way that we checked if an upgrade wasn't necessary was that we saved the version we were at, did an upgrade, and checked to see if we were on the same commit. if so, the upgrade was an essential no-op, and we didn't have to do the second half.
Since we're grabbing the desired upgrade target revision from the start, just exit early without messing with their repo.
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.
That makes sense, thanks Chris!
jmagman
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
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
zanderso
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.
dbc
| newFlutterVersion.frameworkRevision == oldFlutterVersion.frameworkRevision; | ||
| } on Exception catch (e) { | ||
| globals.printTrace('Failed to determine FlutterVersion after upgrade fast-forward: $e'); | ||
| if (result.exitCode != 0) { |
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.
throwOnError is true, so you'll get a ProcessException on an error and this condition won't ever be true. Do we have tests with git invocations mocked out and failing?
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 point, lemme look into it.
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.
Created this PR to address.
* [flutter_tools] fix type error in symbolize (#55212) * [flutter_tools] check first for stable tag, then dev tag (#55342) * [flutter_tools] enable `flutter upgrade` to support force pushed branches (#55594) * [flutter_tools] catch ProcessException and throw ToolExit during upgrade (#55759) * Update engine version to 376ad6a64b08aa26005e3f82aed26de2e290b572 Co-authored-by: Jonah Williams <campfish91@gmail.com> Co-authored-by: Christopher Fujino <fujino@google.com> Co-authored-by: Christopher Fujino <christopherfujino@gmail.com>
Description
In #53715 I removed support for
flutter upgrade-ing forward through a force pushed branch assuming that we would not be force pushing in the future, and to allow thedowngrade_upgrade_integration_testto properly test upgrading.However, because of #55576, we will have to again force push past hotfixes. The way upgrading from hotfixed branches previously worked was:
v1.2.3+hotfix.4 -> v1.2.3)git pull --fffast forward to the tip of the branch (e.g.v1.2.3 -> 1.3.0).However, with the new release scheme, finding the point to reset to is not as simple as stripping out the
+hotfix.xfrom the tag (I'm guessing we could usegit merge-base master <channel>. However this would regress thedowngrade_upgrade_integration_test, and since we're doing a hard reset, we might as well just hard reset to the upstream HEAD:git fetchgit rev-parse --verify @{u}git reset --hard <revision from last step>Related Issues
Fixes #55576.
Tests
I updated mocks to the unit tests and the
downgrade_upgrade_integration_teststill passes.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].