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
2123c93a
Unverified
Commit
2123c93a
authored
May 21, 2021
by
Christopher Fujino
Committed by
GitHub
May 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix candidates (#82957)
parent
1061715f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
5 deletions
+67
-5
candidates.dart
dev/tools/lib/candidates.dart
+6
-2
candidates_test.dart
dev/tools/test/candidates_test.dart
+61
-3
No files found.
dev/tools/lib/candidates.dart
View file @
2123c93a
...
...
@@ -82,14 +82,18 @@ class CandidatesCommand extends Command<void> {
final
int
y
=
int
.
parse
(
candidateMatch
.
group
(
2
)!);
final
int
m
=
int
.
parse
(
candidateMatch
.
group
(
3
)!);
final
RegExpMatch
match
=
remotePattern
.
firstMatch
(
branchName
)!;
final
RegExpMatch
?
match
=
remotePattern
.
firstMatch
(
branchName
);
// If this is not the correct remote
if
(
match
==
null
)
{
continue
;
}
if
(
x
<
currentVersion
.
x
)
{
continue
;
}
if
(
x
==
currentVersion
.
x
&&
y
<
currentVersion
.
y
)
{
continue
;
}
if
(
x
==
currentX
&&
y
==
currentY
&&
currentZ
==
0
&&
m
<
currentM
)
{
if
(
x
==
currentX
&&
y
==
currentY
&&
currentZ
==
0
&&
m
<
=
currentM
)
{
continue
;
}
stdio
.
printStatus
(
match
.
group
(
1
)!);
...
...
dev/tools/test/candidates_test.dart
View file @
2123c93a
...
...
@@ -41,7 +41,7 @@ void main() {
test
(
'prints only branches from targeted remote'
,
()
async
{
const
String
currentVersion
=
'1.2.3'
;
const
String
branch
=
'flutter-1.
2
-candidate.0'
;
const
String
branch
=
'flutter-1.
3
-candidate.0'
;
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
...
...
@@ -64,7 +64,7 @@ void main() {
'
$remoteName
/*'
,
],
stdout:
<
String
>[
'other-remote/
branch1
'
,
'other-remote/
flutter-5.0-candidate.0
'
,
'
$remoteName
/
$branch
'
,
].
join
(
'
\n
'
),
),
...
...
@@ -89,7 +89,65 @@ void main() {
await
runner
.
run
(<
String
>[
'candidates'
,
'--
$kRemote
'
,
remoteName
]);
expect
(
stdio
.
stdout
.
contains
(
'currentVersion =
$currentVersion
'
),
true
);
expect
(
stdio
.
stdout
.
contains
(
branch
),
true
);
expect
(
stdio
.
stdout
.
contains
(
'branch1'
),
false
);
expect
(
stdio
.
stdout
.
contains
(
'flutter-5.0-candidate.0'
),
false
);
});
test
(
'does not print branches older or equal to current version'
,
()
async
{
const
String
currentVersion
=
'2.3.0-13.0.pre.48'
;
const
String
newBranch
=
'flutter-2.4-candidate.0'
;
const
String
oldBranch
=
'flutter-1.0-candidate.0'
;
const
String
currentBranch
=
'flutter-2.3-candidate.13'
;
processManager
=
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
'git'
,
'fetch'
,
remoteName
],
),
const
FakeCommand
(
command:
<
String
>[
flutterBinPath
,
'help'
],
),
const
FakeCommand
(
command:
<
String
>[
flutterBinPath
,
'--version'
,
'--machine'
],
stdout:
'{"frameworkVersion": "
$currentVersion
"}'
,
),
FakeCommand
(
command:
const
<
String
>[
'git'
,
'branch'
,
'--no-color'
,
'--remotes'
,
'--list'
,
'
$remoteName
/*'
,
],
stdout:
<
String
>[
'
$remoteName
/
$oldBranch
'
,
'
$remoteName
/
$currentBranch
'
,
'
$remoteName
/
$newBranch
'
,
].
join
(
'
\n
'
),
),
]);
final
String
pathSeparator
=
operatingSystem
==
'windows'
?
r'\'
:
'/'
;
platform
=
FakePlatform
(
environment:
<
String
,
String
>{
'HOME'
:
<
String
>[
'path'
,
'to'
,
'home'
].
join
(
pathSeparator
),
},
pathSeparator:
pathSeparator
,
);
final
Checkouts
checkouts
=
Checkouts
(
fileSystem:
fileSystem
,
parentDirectory:
fileSystem
.
directory
(
checkoutsParentDirectory
),
platform:
platform
,
processManager:
processManager
,
stdio:
stdio
,
);
final
CommandRunner
<
void
>
runner
=
createRunner
(
checkouts:
checkouts
);
await
runner
.
run
(<
String
>[
'candidates'
,
'--
$kRemote
'
,
remoteName
]);
expect
(
stdio
.
stdout
.
contains
(
'currentVersion =
$currentVersion
'
),
true
);
expect
(
stdio
.
stdout
.
contains
(
newBranch
),
true
);
expect
(
stdio
.
stdout
.
contains
(
oldBranch
),
false
);
expect
(
stdio
.
stdout
.
contains
(
currentBranch
),
false
);
print
(
stdio
.
stdout
);
});
},
onPlatform:
<
String
,
dynamic
>{
'windows'
:
const
Skip
(
'Flutter Conductor only supported on macos/linux'
),
...
...
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