Unverified Commit 1b9cba4b authored by Greg Spencer's avatar Greg Spencer Committed by GitHub

Make sure we refer to 'stable', and not 'release' branch. (#23745)

parent b8c3e0db
......@@ -45,7 +45,7 @@ class ProcessRunnerException implements Exception {
}
}
enum Branch { dev, beta, release }
enum Branch { dev, beta, stable }
String getBranchName(Branch branch) {
switch (branch) {
......@@ -53,8 +53,8 @@ String getBranchName(Branch branch) {
return 'beta';
case Branch.dev:
return 'dev';
case Branch.release:
return 'release';
case Branch.stable:
return 'stable';
}
return null;
}
......@@ -65,8 +65,8 @@ Branch fromBranchName(String name) {
return Branch.beta;
case 'dev':
return Branch.dev;
case 'release':
return Branch.release;
case 'stable':
return Branch.stable;
default:
throw ArgumentError('Invalid branch name.');
}
......
......@@ -221,7 +221,7 @@ void main() {
final String archiveName = platform.isLinux ? 'archive.tar.xz' : 'archive.zip';
final String archiveMime = platform.isLinux ? 'application/x-gtar' : 'application/zip';
final String archivePath = path.join(tempDir.absolute.path, archiveName);
final String gsArchivePath = 'gs://flutter_infra/releases/release/$platformName/$archiveName';
final String gsArchivePath = 'gs://flutter_infra/releases/stable/$platformName/$archiveName';
final String jsonPath = path.join(tempDir.absolute.path, releasesName);
final String gsJsonPath = 'gs://flutter_infra/releases/$releasesName';
final String releasesJson = '''{
......@@ -247,10 +247,10 @@ void main() {
},
{
"hash": "$testRef",
"channel": "release",
"channel": "stable",
"version": "v0.0.0",
"release_date": "2018-03-20T01:47:02.851729Z",
"archive": "release/$platformName/flutter_${platformName}_v0.0.0-dev.zip"
"archive": "stable/$platformName/flutter_${platformName}_v0.0.0-dev.zip"
}
]
}
......@@ -269,7 +269,7 @@ void main() {
final ArchivePublisher publisher = ArchivePublisher(
tempDir,
testRef,
Branch.release,
Branch.stable,
'v1.2.3',
outputFile,
processManager: processManager,
......@@ -284,8 +284,8 @@ void main() {
final String contents = releaseFile.readAsStringSync();
// Make sure new data is added.
expect(contents, contains('"hash": "$testRef"'));
expect(contents, contains('"channel": "release"'));
expect(contents, contains('"archive": "release/$platformName/$archiveName"'));
expect(contents, contains('"channel": "stable"'));
expect(contents, contains('"archive": "stable/$platformName/$archiveName"'));
// Make sure existing entries are preserved.
expect(contents, contains('"hash": "5a58b36e36b8d7aace89d3950e6deb307956a6a0"'));
expect(contents, contains('"hash": "b9bd51cc36b706215915711e580851901faebb40"'));
......
......@@ -47,7 +47,7 @@ class FlutterVersion {
'master',
'dev',
'beta',
'release',
'stable',
]);
/// This maps old branch names to the names of branches that replaced them.
......@@ -63,7 +63,7 @@ class FlutterVersion {
String _channel;
/// The channel is the upstream branch.
/// `master`, `dev`, `beta`, `release`; or old ones, like `alpha`, `hackathon`, ...
/// `master`, `dev`, `beta`, `stable`; or old ones, like `alpha`, `hackathon`, ...
String get channel => _channel;
/// The name of the local branch.
......
......@@ -56,8 +56,10 @@ void main() {
final Process process = createMockProcess(
stdout: 'origin/dev\n'
'origin/beta\n'
'origin/stable\n'
'upstream/dev\n'
'upstream/beta\n');
'upstream/beta\n'
'upstream/stable\n');
when(mockProcessManager.start(
<String>['git', 'branch', '-r'],
workingDirectory: anyNamed('workingDirectory'),
......@@ -83,7 +85,7 @@ void main() {
.where((String line) => line?.isNotEmpty == true)
.skip(1); // remove `Flutter channels:` line
expect(rows, <String>['dev', 'beta']);
expect(rows, <String>['dev', 'beta', 'stable']);
}, overrides: <Type, Generator>{
ProcessManager: () => mockProcessManager,
});
......@@ -127,6 +129,40 @@ void main() {
expect(testLogger.statusText, contains("Switching to flutter channel 'beta'..."));
expect(testLogger.errorText, hasLength(0));
when(mockProcessManager.start(
<String>['git', 'fetch'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).thenAnswer((_) => Future<Process>.value(createMockProcess()));
when(mockProcessManager.start(
<String>['git', 'show-ref', '--verify', '--quiet', 'refs/heads/stable'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).thenAnswer((_) => Future<Process>.value(createMockProcess()));
when(mockProcessManager.start(
<String>['git', 'checkout', 'stable', '--'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).thenAnswer((_) => Future<Process>.value(createMockProcess()));
await runner.run(<String>['channel', 'stable']);
verify(mockProcessManager.start(
<String>['git', 'fetch'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).called(1);
verify(mockProcessManager.start(
<String>['git', 'show-ref', '--verify', '--quiet', 'refs/heads/stable'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).called(1);
verify(mockProcessManager.start(
<String>['git', 'checkout', 'stable', '--'],
workingDirectory: anyNamed('workingDirectory'),
environment: anyNamed('environment'),
)).called(1);
}, overrides: <Type, Generator>{
ProcessManager: () => mockProcessManager,
FileSystem: () => MemoryFileSystem(),
......
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