From 9455fb64d937bcc0e0fdb9300273871c621adc02 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Fri, 14 Apr 2017 09:58:31 -0700 Subject: [PATCH] Allow upgrades and version checks against the alpha branch (#9387) Fixes https://github.com/flutter/flutter/issues/9258 --- packages/flutter_tools/lib/src/commands/upgrade.dart | 6 ------ packages/flutter_tools/lib/src/version.dart | 9 +++++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/packages/flutter_tools/lib/src/commands/upgrade.dart b/packages/flutter_tools/lib/src/commands/upgrade.dart index ca963bcd58..d86864c2a3 100644 --- a/packages/flutter_tools/lib/src/commands/upgrade.dart +++ b/packages/flutter_tools/lib/src/commands/upgrade.dart @@ -36,12 +36,6 @@ class UpgradeCommand extends FlutterCommand { } final FlutterVersion flutterVersion = FlutterVersion.instance; - if (flutterVersion.channel == 'alpha') { - // The alpha branch is deprecated. Rather than trying to pull the alpha - // branch, we should switch upstream to master. - printStatus('Switching to from alpha to master...'); - runSync(['git', 'branch', '--set-upstream-to=origin/master']); - } printStatus('Upgrading Flutter from ${Cache.flutterRoot}...'); diff --git a/packages/flutter_tools/lib/src/version.dart b/packages/flutter_tools/lib/src/version.dart index 0cdcf1c5f8..9aa8c1d494 100644 --- a/packages/flutter_tools/lib/src/version.dart +++ b/packages/flutter_tools/lib/src/version.dart @@ -107,7 +107,7 @@ class FlutterVersion { /// /// Throws [ToolExit] if a git command fails, for example, when the remote git /// repository is not reachable due to a network issue. - static Future fetchRemoteFrameworkCommitDate() async { + static Future fetchRemoteFrameworkCommitDate(String branch) async { await _removeVersionCheckRemoteIfExists(); try { await _run([ @@ -117,8 +117,8 @@ class FlutterVersion { _kVersionCheckRemote, 'https://github.com/flutter/flutter.git', ]); - await _run(['git', 'fetch', _kVersionCheckRemote, 'master']); - return _latestGitCommitDate('$_kVersionCheckRemote/master'); + await _run(['git', 'fetch', _kVersionCheckRemote, branch]); + return _latestGitCommitDate('$_kVersionCheckRemote/$branch'); } finally { await _removeVersionCheckRemoteIfExists(); } @@ -243,7 +243,8 @@ class FlutterVersion { // Cache is empty or it's been a while since the last server ping. Ping the server. try { - final DateTime remoteFrameworkCommitDate = DateTime.parse(await FlutterVersion.fetchRemoteFrameworkCommitDate()); + final String branch = _channel == 'alpha' ? 'alpha' : 'master'; + final DateTime remoteFrameworkCommitDate = DateTime.parse(await FlutterVersion.fetchRemoteFrameworkCommitDate(branch)); versionCheckStamp.store( newTimeVersionWasChecked: _clock.now(), newKnownRemoteVersion: remoteFrameworkCommitDate,