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
604e9dc6
Unverified
Commit
604e9dc6
authored
Mar 01, 2019
by
Alexander Markov
Committed by
GitHub
Mar 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include git output into error message from channel command (#28658)
parent
be083da9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
channel.dart
packages/flutter_tools/lib/src/commands/channel.dart
+12
-4
channel_test.dart
packages/flutter_tools/test/channel_test.dart
+10
-2
No files found.
packages/flutter_tools/lib/src/commands/channel.dart
View file @
604e9dc6
...
@@ -35,7 +35,10 @@ class ChannelCommand extends FlutterCommand {
...
@@ -35,7 +35,10 @@ class ChannelCommand extends FlutterCommand {
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
switch
(
argResults
.
rest
.
length
)
{
switch
(
argResults
.
rest
.
length
)
{
case
0
:
case
0
:
await
_listChannels
(
showAll:
argResults
[
'all'
]);
await
_listChannels
(
showAll:
argResults
[
'all'
],
verbose:
globalResults
[
'verbose'
]
);
return
null
;
return
null
;
case
1
:
case
1
:
await
_switchChannel
(
argResults
.
rest
[
0
]);
await
_switchChannel
(
argResults
.
rest
[
0
]);
...
@@ -45,11 +48,12 @@ class ChannelCommand extends FlutterCommand {
...
@@ -45,11 +48,12 @@ class ChannelCommand extends FlutterCommand {
}
}
}
}
Future
<
void
>
_listChannels
({
bool
showAll
})
async
{
Future
<
void
>
_listChannels
({
bool
showAll
,
bool
verbose
})
async
{
// Beware: currentBranch could contain PII. See getBranchName().
// Beware: currentBranch could contain PII. See getBranchName().
final
String
currentChannel
=
FlutterVersion
.
instance
.
channel
;
final
String
currentChannel
=
FlutterVersion
.
instance
.
channel
;
final
String
currentBranch
=
FlutterVersion
.
instance
.
getBranchName
();
final
String
currentBranch
=
FlutterVersion
.
instance
.
getBranchName
();
final
Set
<
String
>
seenChannels
=
Set
<
String
>();
final
Set
<
String
>
seenChannels
=
Set
<
String
>();
final
List
<
String
>
rawOutput
=
<
String
>[];
showAll
=
showAll
||
currentChannel
!=
currentBranch
;
showAll
=
showAll
||
currentChannel
!=
currentBranch
;
...
@@ -58,6 +62,8 @@ class ChannelCommand extends FlutterCommand {
...
@@ -58,6 +62,8 @@ class ChannelCommand extends FlutterCommand {
<
String
>[
'git'
,
'branch'
,
'-r'
],
<
String
>[
'git'
,
'branch'
,
'-r'
],
workingDirectory:
Cache
.
flutterRoot
,
workingDirectory:
Cache
.
flutterRoot
,
mapFunction:
(
String
line
)
{
mapFunction:
(
String
line
)
{
if
(
verbose
)
rawOutput
.
add
(
line
);
final
List
<
String
>
split
=
line
.
split
(
'/'
);
final
List
<
String
>
split
=
line
.
split
(
'/'
);
if
(
split
.
length
<
2
)
if
(
split
.
length
<
2
)
return
null
;
return
null
;
...
@@ -74,8 +80,10 @@ class ChannelCommand extends FlutterCommand {
...
@@ -74,8 +80,10 @@ class ChannelCommand extends FlutterCommand {
return
null
;
return
null
;
},
},
);
);
if
(
result
!=
0
)
if
(
result
!=
0
)
{
throwToolExit
(
'List channels failed:
$result
'
,
exitCode:
result
);
final
String
details
=
verbose
?
'
\n
${rawOutput.join('\n')}
'
:
''
;
throwToolExit
(
'List channels failed:
$result$details
'
,
exitCode:
result
);
}
}
}
Future
<
void
>
_switchChannel
(
String
branchName
)
{
Future
<
void
>
_switchChannel
(
String
branchName
)
{
...
...
packages/flutter_tools/test/channel_test.dart
View file @
604e9dc6
...
@@ -41,15 +41,23 @@ void main() {
...
@@ -41,15 +41,23 @@ void main() {
Cache
.
disableLocking
();
Cache
.
disableLocking
();
});
});
testUsingContext
(
'list'
,
(
)
async
{
Future
<
void
>
simpleChannelTest
(
List
<
String
>
args
)
async
{
final
ChannelCommand
command
=
ChannelCommand
();
final
ChannelCommand
command
=
ChannelCommand
();
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(
<
String
>[
'channel'
]
);
await
runner
.
run
(
args
);
expect
(
testLogger
.
errorText
,
hasLength
(
0
));
expect
(
testLogger
.
errorText
,
hasLength
(
0
));
// The bots may return an empty list of channels (network hiccup?)
// The bots may return an empty list of channels (network hiccup?)
// and when run locally the list of branches might be different
// and when run locally the list of branches might be different
// so we check for the header text rather than any specific channel name.
// so we check for the header text rather than any specific channel name.
expect
(
testLogger
.
statusText
,
contains
(
'Flutter channels:'
));
expect
(
testLogger
.
statusText
,
contains
(
'Flutter channels:'
));
}
testUsingContext
(
'list'
,
()
async
{
await
simpleChannelTest
(<
String
>[
'channel'
]);
});
testUsingContext
(
'verbose list'
,
()
async
{
await
simpleChannelTest
(<
String
>[
'channel'
,
'-v'
]);
});
});
testUsingContext
(
'removes duplicates'
,
()
async
{
testUsingContext
(
'removes duplicates'
,
()
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