Switch to relevant Remote constructors (#146773)

[A previous PR](https://github.com/flutter/flutter/pull/144279) implemented `const` constructors in the `Remote` class, so I wanted to follow up and use those constructors in the appropriate places.
This commit is contained in:
Nate 2024-04-16 18:55:59 -05:00 committed by GitHub
parent 3d51fa9b9c
commit 34bc632493
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 15 additions and 51 deletions

View File

@ -93,10 +93,7 @@ class NextContext extends Context {
]; ];
switch (state.currentPhase) { switch (state.currentPhase) {
case pb.ReleasePhase.APPLY_ENGINE_CHERRYPICKS: case pb.ReleasePhase.APPLY_ENGINE_CHERRYPICKS:
final Remote upstream = Remote( final Remote upstream = Remote.upstream(state.engine.upstream.url);
name: RemoteName.upstream,
url: state.engine.upstream.url,
);
final EngineRepository engine = EngineRepository( final EngineRepository engine = EngineRepository(
checkouts, checkouts,
initialRef: state.engine.workingBranch, initialRef: state.engine.workingBranch,
@ -153,10 +150,7 @@ class NextContext extends Context {
} }
} }
case pb.ReleasePhase.APPLY_FRAMEWORK_CHERRYPICKS: case pb.ReleasePhase.APPLY_FRAMEWORK_CHERRYPICKS:
final Remote engineUpstreamRemote = Remote( final Remote engineUpstreamRemote = Remote.upstream(state.engine.upstream.url);
name: RemoteName.upstream,
url: state.engine.upstream.url,
);
final EngineRepository engine = EngineRepository( final EngineRepository engine = EngineRepository(
checkouts, checkouts,
// We explicitly want to check out the merged version from upstream // We explicitly want to check out the merged version from upstream
@ -167,10 +161,7 @@ class NextContext extends Context {
final String engineRevision = await engine.reverseParse('HEAD'); final String engineRevision = await engine.reverseParse('HEAD');
final Remote upstream = Remote( final Remote upstream = Remote.upstream(state.framework.upstream.url);
name: RemoteName.upstream,
url: state.framework.upstream.url,
);
final FrameworkRepository framework = FrameworkRepository( final FrameworkRepository framework = FrameworkRepository(
checkouts, checkouts,
initialRef: state.framework.workingBranch, initialRef: state.framework.workingBranch,

View File

@ -520,8 +520,7 @@ class FrameworkRepository extends Repository {
FrameworkRepository( FrameworkRepository(
this.checkouts, { this.checkouts, {
super.name = 'framework', super.name = 'framework',
super.upstreamRemote = const Remote( super.upstreamRemote = const Remote.upstream(FrameworkRepository.defaultUpstream),
name: RemoteName.upstream, url: FrameworkRepository.defaultUpstream),
super.localUpstream, super.localUpstream,
super.previousCheckoutLocation, super.previousCheckoutLocation,
String super.initialRef = FrameworkRepository.defaultBranch, String super.initialRef = FrameworkRepository.defaultBranch,
@ -553,10 +552,7 @@ class FrameworkRepository extends Repository {
return FrameworkRepository( return FrameworkRepository(
checkouts, checkouts,
name: name, name: name,
upstreamRemote: Remote( upstreamRemote: Remote.upstream('file://$upstreamPath/'),
name: RemoteName.upstream,
url: 'file://$upstreamPath/',
),
previousCheckoutLocation: previousCheckoutLocation, previousCheckoutLocation: previousCheckoutLocation,
initialRef: initialRef, initialRef: initialRef,
); );
@ -581,9 +577,7 @@ class FrameworkRepository extends Repository {
return FrameworkRepository( return FrameworkRepository(
checkouts, checkouts,
name: cloneName, name: cloneName,
upstreamRemote: Remote( upstreamRemote: Remote.upstream('file://${(await checkoutDirectory).path}/'),
name: RemoteName.upstream,
url: 'file://${(await checkoutDirectory).path}/'),
); );
} }
@ -737,10 +731,7 @@ class HostFrameworkRepository extends FrameworkRepository {
}) : super( }) : super(
checkouts, checkouts,
name: name, name: name,
upstreamRemote: Remote( upstreamRemote: Remote.upstream('file://$upstreamPath/'),
name: RemoteName.upstream,
url: 'file://$upstreamPath/',
),
localUpstream: false, localUpstream: false,
) { ) {
_checkoutDirectory = checkouts.fileSystem.directory(upstreamPath); _checkoutDirectory = checkouts.fileSystem.directory(upstreamPath);
@ -795,8 +786,7 @@ class EngineRepository extends Repository {
this.checkouts, { this.checkouts, {
super.name = 'engine', super.name = 'engine',
String super.initialRef = EngineRepository.defaultBranch, String super.initialRef = EngineRepository.defaultBranch,
super.upstreamRemote = const Remote( super.upstreamRemote = const Remote.upstream(EngineRepository.defaultUpstream),
name: RemoteName.upstream, url: EngineRepository.defaultUpstream),
super.localUpstream, super.localUpstream,
super.previousCheckoutLocation, super.previousCheckoutLocation,
super.mirrorRemote, super.mirrorRemote,
@ -847,9 +837,7 @@ class EngineRepository extends Repository {
return EngineRepository( return EngineRepository(
checkouts, checkouts,
name: cloneName, name: cloneName,
upstreamRemote: Remote( upstreamRemote: Remote.upstream('file://${(await checkoutDirectory).path}/'),
name: RemoteName.upstream,
url: 'file://${(await checkoutDirectory).path}/'),
); );
} }
} }

View File

@ -218,26 +218,14 @@ class StartContext extends Context {
engine = EngineRepository( engine = EngineRepository(
checkouts, checkouts,
initialRef: 'upstream/$candidateBranch', initialRef: 'upstream/$candidateBranch',
upstreamRemote: Remote( upstreamRemote: Remote.upstream(engineUpstream),
name: RemoteName.upstream, mirrorRemote: Remote.mirror(engineMirror),
url: engineUpstream,
),
mirrorRemote: Remote(
name: RemoteName.mirror,
url: engineMirror,
),
), ),
framework = FrameworkRepository( framework = FrameworkRepository(
checkouts, checkouts,
initialRef: 'upstream/$candidateBranch', initialRef: 'upstream/$candidateBranch',
upstreamRemote: Remote( upstreamRemote: Remote.upstream(frameworkUpstream),
name: RemoteName.upstream, mirrorRemote: Remote.mirror(frameworkMirror),
url: frameworkUpstream,
),
mirrorRemote: Remote(
name: RemoteName.mirror,
url: frameworkMirror,
),
); );
final String candidateBranch; final String candidateBranch;

View File

@ -1002,7 +1002,7 @@ class _TestRepository extends Repository {
name: name, name: name,
requiredLocalBranches: <String>[], requiredLocalBranches: <String>[],
stdio: checkouts.stdio, stdio: checkouts.stdio,
upstreamRemote: const Remote(name: RemoteName.upstream, url: 'git@github.com:upstream/repo.git'), upstreamRemote: const Remote.upstream('git@github.com:upstream/repo.git'),
); );
@override @override

View File

@ -50,10 +50,7 @@ void main() {
); );
framework = FrameworkRepository( framework = FrameworkRepository(
checkouts, checkouts,
mirrorRemote: const Remote( mirrorRemote: const Remote.mirror(mirrorUrl),
name: RemoteName.mirror,
url: mirrorUrl,
),
); );
autoroller = PackageAutoroller( autoroller = PackageAutoroller(