Skip to content

Commit 34bc632

Browse files
Switch to relevant Remote constructors (#146773)
[A previous PR](flutter/flutter#144279) implemented `const` constructors in the `Remote` class, so I wanted to follow up and use those constructors in the appropriate places.
1 parent 3d51fa9 commit 34bc632

File tree

5 files changed

+15
-51
lines changed

5 files changed

+15
-51
lines changed

dev/conductor/core/lib/src/next.dart

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,7 @@ class NextContext extends Context {
9393
];
9494
switch (state.currentPhase) {
9595
case pb.ReleasePhase.APPLY_ENGINE_CHERRYPICKS:
96-
final Remote upstream = Remote(
97-
name: RemoteName.upstream,
98-
url: state.engine.upstream.url,
99-
);
96+
final Remote upstream = Remote.upstream(state.engine.upstream.url);
10097
final EngineRepository engine = EngineRepository(
10198
checkouts,
10299
initialRef: state.engine.workingBranch,
@@ -153,10 +150,7 @@ class NextContext extends Context {
153150
}
154151
}
155152
case pb.ReleasePhase.APPLY_FRAMEWORK_CHERRYPICKS:
156-
final Remote engineUpstreamRemote = Remote(
157-
name: RemoteName.upstream,
158-
url: state.engine.upstream.url,
159-
);
153+
final Remote engineUpstreamRemote = Remote.upstream(state.engine.upstream.url);
160154
final EngineRepository engine = EngineRepository(
161155
checkouts,
162156
// We explicitly want to check out the merged version from upstream
@@ -167,10 +161,7 @@ class NextContext extends Context {
167161

168162
final String engineRevision = await engine.reverseParse('HEAD');
169163

170-
final Remote upstream = Remote(
171-
name: RemoteName.upstream,
172-
url: state.framework.upstream.url,
173-
);
164+
final Remote upstream = Remote.upstream(state.framework.upstream.url);
174165
final FrameworkRepository framework = FrameworkRepository(
175166
checkouts,
176167
initialRef: state.framework.workingBranch,

dev/conductor/core/lib/src/repository.dart

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,7 @@ class FrameworkRepository extends Repository {
520520
FrameworkRepository(
521521
this.checkouts, {
522522
super.name = 'framework',
523-
super.upstreamRemote = const Remote(
524-
name: RemoteName.upstream, url: FrameworkRepository.defaultUpstream),
523+
super.upstreamRemote = const Remote.upstream(FrameworkRepository.defaultUpstream),
525524
super.localUpstream,
526525
super.previousCheckoutLocation,
527526
String super.initialRef = FrameworkRepository.defaultBranch,
@@ -553,10 +552,7 @@ class FrameworkRepository extends Repository {
553552
return FrameworkRepository(
554553
checkouts,
555554
name: name,
556-
upstreamRemote: Remote(
557-
name: RemoteName.upstream,
558-
url: 'file://$upstreamPath/',
559-
),
555+
upstreamRemote: Remote.upstream('file://$upstreamPath/'),
560556
previousCheckoutLocation: previousCheckoutLocation,
561557
initialRef: initialRef,
562558
);
@@ -581,9 +577,7 @@ class FrameworkRepository extends Repository {
581577
return FrameworkRepository(
582578
checkouts,
583579
name: cloneName,
584-
upstreamRemote: Remote(
585-
name: RemoteName.upstream,
586-
url: 'file://${(await checkoutDirectory).path}/'),
580+
upstreamRemote: Remote.upstream('file://${(await checkoutDirectory).path}/'),
587581
);
588582
}
589583

@@ -737,10 +731,7 @@ class HostFrameworkRepository extends FrameworkRepository {
737731
}) : super(
738732
checkouts,
739733
name: name,
740-
upstreamRemote: Remote(
741-
name: RemoteName.upstream,
742-
url: 'file://$upstreamPath/',
743-
),
734+
upstreamRemote: Remote.upstream('file://$upstreamPath/'),
744735
localUpstream: false,
745736
) {
746737
_checkoutDirectory = checkouts.fileSystem.directory(upstreamPath);
@@ -795,8 +786,7 @@ class EngineRepository extends Repository {
795786
this.checkouts, {
796787
super.name = 'engine',
797788
String super.initialRef = EngineRepository.defaultBranch,
798-
super.upstreamRemote = const Remote(
799-
name: RemoteName.upstream, url: EngineRepository.defaultUpstream),
789+
super.upstreamRemote = const Remote.upstream(EngineRepository.defaultUpstream),
800790
super.localUpstream,
801791
super.previousCheckoutLocation,
802792
super.mirrorRemote,
@@ -847,9 +837,7 @@ class EngineRepository extends Repository {
847837
return EngineRepository(
848838
checkouts,
849839
name: cloneName,
850-
upstreamRemote: Remote(
851-
name: RemoteName.upstream,
852-
url: 'file://${(await checkoutDirectory).path}/'),
840+
upstreamRemote: Remote.upstream('file://${(await checkoutDirectory).path}/'),
853841
);
854842
}
855843
}

dev/conductor/core/lib/src/start.dart

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -218,26 +218,14 @@ class StartContext extends Context {
218218
engine = EngineRepository(
219219
checkouts,
220220
initialRef: 'upstream/$candidateBranch',
221-
upstreamRemote: Remote(
222-
name: RemoteName.upstream,
223-
url: engineUpstream,
224-
),
225-
mirrorRemote: Remote(
226-
name: RemoteName.mirror,
227-
url: engineMirror,
228-
),
221+
upstreamRemote: Remote.upstream(engineUpstream),
222+
mirrorRemote: Remote.mirror(engineMirror),
229223
),
230224
framework = FrameworkRepository(
231225
checkouts,
232226
initialRef: 'upstream/$candidateBranch',
233-
upstreamRemote: Remote(
234-
name: RemoteName.upstream,
235-
url: frameworkUpstream,
236-
),
237-
mirrorRemote: Remote(
238-
name: RemoteName.mirror,
239-
url: frameworkMirror,
240-
),
227+
upstreamRemote: Remote.upstream(frameworkUpstream),
228+
mirrorRemote: Remote.mirror(frameworkMirror),
241229
);
242230

243231
final String candidateBranch;

dev/conductor/core/test/next_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ class _TestRepository extends Repository {
10021002
name: name,
10031003
requiredLocalBranches: <String>[],
10041004
stdio: checkouts.stdio,
1005-
upstreamRemote: const Remote(name: RemoteName.upstream, url: '[email protected]:upstream/repo.git'),
1005+
upstreamRemote: const Remote.upstream('[email protected]:upstream/repo.git'),
10061006
);
10071007

10081008
@override

dev/conductor/core/test/packages_autoroller_test.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ void main() {
5050
);
5151
framework = FrameworkRepository(
5252
checkouts,
53-
mirrorRemote: const Remote(
54-
name: RemoteName.mirror,
55-
url: mirrorUrl,
56-
),
53+
mirrorRemote: const Remote.mirror(mirrorUrl),
5754
);
5855

5956
autoroller = PackageAutoroller(

0 commit comments

Comments
 (0)