Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
688948b7
Unverified
Commit
688948b7
authored
Jan 31, 2020
by
Prerak Mann
Committed by
GitHub
Jan 31, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switching channel prompts to run flutter upgrade (#49511)
parent
b5f328e3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
2 deletions
+49
-2
channel.dart
packages/flutter_tools/lib/src/commands/channel.dart
+4
-2
channel_test.dart
packages/flutter_tools/test/general.shard/channel_test.dart
+45
-0
No files found.
packages/flutter_tools/lib/src/commands/channel.dart
View file @
688948b7
...
...
@@ -116,7 +116,7 @@ class ChannelCommand extends FlutterCommand {
}
}
Future
<
void
>
_switchChannel
(
String
branchName
)
{
Future
<
void
>
_switchChannel
(
String
branchName
)
async
{
globals
.
printStatus
(
"Switching to flutter channel '
$branchName
'..."
);
if
(
FlutterVersion
.
obsoleteBranches
.
containsKey
(
branchName
))
{
final
String
alternative
=
FlutterVersion
.
obsoleteBranches
[
branchName
];
...
...
@@ -124,7 +124,9 @@ class ChannelCommand extends FlutterCommand {
}
else
if
(!
FlutterVersion
.
officialChannels
.
contains
(
branchName
))
{
globals
.
printStatus
(
'This is not an official channel. For a list of available channels, try "flutter channel".'
);
}
return
_checkout
(
branchName
);
await
_checkout
(
branchName
);
globals
.
printStatus
(
"Successfully switched to flutter channel '
$branchName
'."
);
globals
.
printStatus
(
"To ensure that you're on the latest build from this channel, run 'flutter upgrade'"
);
}
static
Future
<
void
>
upgradeChannel
()
async
{
...
...
packages/flutter_tools/test/general.shard/channel_test.dart
View file @
688948b7
...
...
@@ -253,6 +253,51 @@ void main() {
ProcessManager:
()
=>
mockProcessManager
,
});
testUsingContext
(
'switching channels prompts to run flutter upgrade'
,
()
async
{
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/beta'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenAnswer
((
_
)
=>
Future
<
Process
>.
value
(
createMockProcess
()));
when
(
mockProcessManager
.
start
(
<
String
>[
'git'
,
'checkout'
,
'beta'
,
'--'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
thenAnswer
((
_
)
=>
Future
<
Process
>.
value
(
createMockProcess
()));
final
ChannelCommand
command
=
ChannelCommand
();
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'channel'
,
'beta'
]);
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/beta'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
called
(
1
);
verify
(
mockProcessManager
.
start
(
<
String
>[
'git'
,
'checkout'
,
'beta'
,
'--'
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
)).
called
(
1
);
expect
(
testLogger
.
statusText
,
contains
(
"Successfully switched to flutter channel 'beta'."
));
expect
(
testLogger
.
statusText
,
contains
(
"To ensure that you're on the latest build from this channel, run 'flutter upgrade'"
));
expect
(
testLogger
.
errorText
,
hasLength
(
0
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
MemoryFileSystem
(),
ProcessManager:
()
=>
mockProcessManager
,
});
// This verifies that bug https://github.com/flutter/flutter/issues/21134
// doesn't return.
testUsingContext
(
'removes version stamp file when switching channels'
,
()
async
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment