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
4484ae40
Commit
4484ae40
authored
Dec 04, 2019
by
Zachary Anderson
Committed by
Todd Volkert
Dec 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tool] Do not continue with a no-op 'upgrade' (#46011)
parent
066a992a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
4 deletions
+49
-4
upgrade.dart
packages/flutter_tools/lib/src/commands/upgrade.dart
+22
-3
upgrade_test.dart
...ter_tools/test/commands.shard/permeable/upgrade_test.dart
+27
-1
No files found.
packages/flutter_tools/lib/src/commands/upgrade.dart
View file @
4484ae40
...
...
@@ -117,8 +117,13 @@ class UpgradeCommandRunner {
}
await
resetChanges
(
gitTagVersion
);
await
upgradeChannel
(
flutterVersion
);
await
attemptFastForward
();
await
flutterUpgradeContinue
();
final
bool
alreadyUpToDate
=
await
attemptFastForward
(
flutterVersion
);
if
(
alreadyUpToDate
)
{
// If the upgrade was a no op, then do not continue with the second half.
printTrace
(
'Flutter is already up to date on channel
${flutterVersion.channel}
'
);
}
else
{
await
flutterUpgradeContinue
();
}
}
Future
<
void
>
flutterUpgradeContinue
()
async
{
...
...
@@ -229,7 +234,10 @@ class UpgradeCommandRunner {
///
/// If there haven't been any hot fixes or local changes, this is equivalent
/// to a fast-forward.
Future
<
void
>
attemptFastForward
()
async
{
///
/// If the fast forward lands us on the same channel and revision, then
/// returns true, otherwise returns false.
Future
<
bool
>
attemptFastForward
(
FlutterVersion
oldFlutterVersion
)
async
{
final
int
code
=
await
processUtils
.
stream
(
<
String
>[
'git'
,
'pull'
,
'--ff'
],
workingDirectory:
Cache
.
flutterRoot
,
...
...
@@ -238,6 +246,17 @@ class UpgradeCommandRunner {
if
(
code
!=
0
)
{
throwToolExit
(
null
,
exitCode:
code
);
}
// Check if the upgrade did anything.
bool
alreadyUpToDate
=
false
;
try
{
final
FlutterVersion
newFlutterVersion
=
FlutterVersion
();
alreadyUpToDate
=
newFlutterVersion
.
channel
==
oldFlutterVersion
.
channel
&&
newFlutterVersion
.
frameworkRevision
==
oldFlutterVersion
.
frameworkRevision
;
}
catch
(
e
)
{
printTrace
(
'Failed to determine FlutterVersion after upgrade fast-forward:
$e
'
);
}
return
alreadyUpToDate
;
}
/// Update the engine repository and precache all artifacts.
...
...
packages/flutter_tools/test/commands.shard/permeable/upgrade_test.dart
View file @
4484ae40
...
...
@@ -121,6 +121,30 @@ void main() {
Platform:
()
=>
fakePlatform
,
});
testUsingContext
(
'Doesn
\'
t continue on known tag, dev branch, no force, already up-to-date'
,
()
async
{
fakeCommandRunner
.
alreadyUpToDate
=
true
;
final
Future
<
FlutterCommandResult
>
result
=
fakeCommandRunner
.
runCommand
(
false
,
false
,
gitTagVersion
,
flutterVersion
,
);
expect
(
await
result
,
null
);
verifyNever
(
processManager
.
start
(
<
String
>[
fs
.
path
.
join
(
'bin'
,
'flutter'
),
'upgrade'
,
'--continue'
,
'--no-version-check'
,
],
environment:
anyNamed
(
'environment'
),
workingDirectory:
anyNamed
(
'workingDirectory'
),
));
},
overrides:
<
Type
,
Generator
>{
ProcessManager:
()
=>
processManager
,
Platform:
()
=>
fakePlatform
,
});
testUsingContext
(
'verifyUpstreamConfigured'
,
()
async
{
when
(
processManager
.
run
(
<
String
>[
'git'
,
'rev-parse'
,
'@{u}'
],
...
...
@@ -288,6 +312,8 @@ void main() {
class
FakeUpgradeCommandRunner
extends
UpgradeCommandRunner
{
bool
willHaveUncomittedChanges
=
false
;
bool
alreadyUpToDate
=
false
;
@override
Future
<
void
>
verifyUpstreamConfigured
()
async
{}
...
...
@@ -301,7 +327,7 @@ class FakeUpgradeCommandRunner extends UpgradeCommandRunner {
Future
<
void
>
upgradeChannel
(
FlutterVersion
flutterVersion
)
async
{}
@override
Future
<
void
>
attemptFastForward
()
async
{}
Future
<
bool
>
attemptFastForward
(
FlutterVersion
flutterVersion
)
async
=>
alreadyUpToDate
;
@override
Future
<
void
>
precacheArtifacts
()
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