Commit 9455fb64 authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Allow upgrades and version checks against the alpha branch (#9387)

Fixes https://github.com/flutter/flutter/issues/9258
parent 9493df2d
...@@ -36,12 +36,6 @@ class UpgradeCommand extends FlutterCommand { ...@@ -36,12 +36,6 @@ class UpgradeCommand extends FlutterCommand {
} }
final FlutterVersion flutterVersion = FlutterVersion.instance; 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(<String>['git', 'branch', '--set-upstream-to=origin/master']);
}
printStatus('Upgrading Flutter from ${Cache.flutterRoot}...'); printStatus('Upgrading Flutter from ${Cache.flutterRoot}...');
......
...@@ -107,7 +107,7 @@ class FlutterVersion { ...@@ -107,7 +107,7 @@ class FlutterVersion {
/// ///
/// Throws [ToolExit] if a git command fails, for example, when the remote git /// Throws [ToolExit] if a git command fails, for example, when the remote git
/// repository is not reachable due to a network issue. /// repository is not reachable due to a network issue.
static Future<String> fetchRemoteFrameworkCommitDate() async { static Future<String> fetchRemoteFrameworkCommitDate(String branch) async {
await _removeVersionCheckRemoteIfExists(); await _removeVersionCheckRemoteIfExists();
try { try {
await _run(<String>[ await _run(<String>[
...@@ -117,8 +117,8 @@ class FlutterVersion { ...@@ -117,8 +117,8 @@ class FlutterVersion {
_kVersionCheckRemote, _kVersionCheckRemote,
'https://github.com/flutter/flutter.git', 'https://github.com/flutter/flutter.git',
]); ]);
await _run(<String>['git', 'fetch', _kVersionCheckRemote, 'master']); await _run(<String>['git', 'fetch', _kVersionCheckRemote, branch]);
return _latestGitCommitDate('$_kVersionCheckRemote/master'); return _latestGitCommitDate('$_kVersionCheckRemote/$branch');
} finally { } finally {
await _removeVersionCheckRemoteIfExists(); await _removeVersionCheckRemoteIfExists();
} }
...@@ -243,7 +243,8 @@ class FlutterVersion { ...@@ -243,7 +243,8 @@ class FlutterVersion {
// Cache is empty or it's been a while since the last server ping. Ping the server. // Cache is empty or it's been a while since the last server ping. Ping the server.
try { 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( versionCheckStamp.store(
newTimeVersionWasChecked: _clock.now(), newTimeVersionWasChecked: _clock.now(),
newKnownRemoteVersion: remoteFrameworkCommitDate, newKnownRemoteVersion: remoteFrameworkCommitDate,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment