Skip to content

Conversation

@christopherfujino
Copy link
Contributor

@christopherfujino christopherfujino commented Apr 24, 2020

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 the downgrade_upgrade_integration_test to 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:

  1. reset backward to the last non-hotfix tag on the branch (e.g. v1.2.3+hotfix.4 -> v1.2.3)
  2. do a git pull --ff fast 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.x from the tag (I'm guessing we could use git merge-base master <channel>. However this would regress the downgrade_upgrade_integration_test, and since we're doing a hard reset, we might as well just hard reset to the upstream HEAD:

  1. fetch the upstream version of the branch, git fetch
  2. retrieve the revision of the upstream HEAD, git rev-parse --verify @{u}
  3. hard reset to the upstream HEAD, git reset --hard <revision from last step>

Related Issues

Fixes #55576.

Tests

I updated mocks to the unit tests and the downgrade_upgrade_integration_test still 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.

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I signed the [CLA].
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read [Handling breaking changes].

  • No, no existing tests failed, so this is not a breaking change.
  • Yes, this is a breaking change. If not, delete the remainder of this section.
    • I wrote a design doc: https://flutter.dev/go/template Replace this with a link to your design doc's short link
    • I got input from the developer relations team, specifically from: Replace with the names of who gave advice
    • I wrote a migration guide: Replace with a link to your migration guide

@fluttergithubbot fluttergithubbot added tool Affects the "flutter" command-line tool. See also t: labels. work in progress; do not review labels Apr 24, 2020
@christopherfujino christopherfujino marked this pull request as ready for review April 24, 2020 20:13
@required bool testFlow,
}) async {
await verifyUpstreamConfigured();
final String upstreamRevision = await fetchRemoteRevision();
Copy link
Contributor

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?

Copy link
Contributor Author

@christopherfujino christopherfujino Apr 24, 2020

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.

Copy link
Contributor

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!

Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@christopherfujino christopherfujino merged commit 4552af1 into flutter:master Apr 25, 2020
@christopherfujino christopherfujino deleted the fix-upgrade branch April 25, 2020 00:55
Copy link
Member

@zanderso zanderso left a 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) {
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

pcsosinski pushed a commit to pcsosinski/flutter that referenced this pull request Apr 28, 2020
pcsosinski pushed a commit that referenced this pull request Apr 28, 2020
* [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>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flutter upgrade should support upstream branches that have been force pushed

6 participants