Skip to content

Commit

Permalink
Switch to relevant Remote constructors (flutter#146773)
Browse files Browse the repository at this point in the history
[A previous PR](flutter#144279) implemented `const` constructors in the `Remote` class, so I wanted to follow up and use those constructors in the appropriate places.
  • Loading branch information
nate-thegrate authored and gilnobrega committed Apr 22, 2024
1 parent ba6d571 commit 979e475
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 51 deletions.
15 changes: 3 additions & 12 deletions dev/conductor/core/lib/src/next.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,7 @@ class NextContext extends Context {
];
switch (state.currentPhase) {
case pb.ReleasePhase.APPLY_ENGINE_CHERRYPICKS:
final Remote upstream = Remote(
name: RemoteName.upstream,
url: state.engine.upstream.url,
);
final Remote upstream = Remote.upstream(state.engine.upstream.url);
final EngineRepository engine = EngineRepository(
checkouts,
initialRef: state.engine.workingBranch,
Expand Down Expand Up @@ -153,10 +150,7 @@ class NextContext extends Context {
}
}
case pb.ReleasePhase.APPLY_FRAMEWORK_CHERRYPICKS:
final Remote engineUpstreamRemote = Remote(
name: RemoteName.upstream,
url: state.engine.upstream.url,
);
final Remote engineUpstreamRemote = Remote.upstream(state.engine.upstream.url);
final EngineRepository engine = EngineRepository(
checkouts,
// We explicitly want to check out the merged version from upstream
Expand All @@ -167,10 +161,7 @@ class NextContext extends Context {

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

final Remote upstream = Remote(
name: RemoteName.upstream,
url: state.framework.upstream.url,
);
final Remote upstream = Remote.upstream(state.framework.upstream.url);
final FrameworkRepository framework = FrameworkRepository(
checkouts,
initialRef: state.framework.workingBranch,
Expand Down
24 changes: 6 additions & 18 deletions dev/conductor/core/lib/src/repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,7 @@ class FrameworkRepository extends Repository {
FrameworkRepository(
this.checkouts, {
super.name = 'framework',
super.upstreamRemote = const Remote(
name: RemoteName.upstream, url: FrameworkRepository.defaultUpstream),
super.upstreamRemote = const Remote.upstream(FrameworkRepository.defaultUpstream),
super.localUpstream,
super.previousCheckoutLocation,
String super.initialRef = FrameworkRepository.defaultBranch,
Expand Down Expand Up @@ -553,10 +552,7 @@ class FrameworkRepository extends Repository {
return FrameworkRepository(
checkouts,
name: name,
upstreamRemote: Remote(
name: RemoteName.upstream,
url: 'file://$upstreamPath/',
),
upstreamRemote: Remote.upstream('file://$upstreamPath/'),
previousCheckoutLocation: previousCheckoutLocation,
initialRef: initialRef,
);
Expand All @@ -581,9 +577,7 @@ class FrameworkRepository extends Repository {
return FrameworkRepository(
checkouts,
name: cloneName,
upstreamRemote: Remote(
name: RemoteName.upstream,
url: 'file://${(await checkoutDirectory).path}/'),
upstreamRemote: Remote.upstream('file://${(await checkoutDirectory).path}/'),
);
}

Expand Down Expand Up @@ -737,10 +731,7 @@ class HostFrameworkRepository extends FrameworkRepository {
}) : super(
checkouts,
name: name,
upstreamRemote: Remote(
name: RemoteName.upstream,
url: 'file://$upstreamPath/',
),
upstreamRemote: Remote.upstream('file://$upstreamPath/'),
localUpstream: false,
) {
_checkoutDirectory = checkouts.fileSystem.directory(upstreamPath);
Expand Down Expand Up @@ -795,8 +786,7 @@ class EngineRepository extends Repository {
this.checkouts, {
super.name = 'engine',
String super.initialRef = EngineRepository.defaultBranch,
super.upstreamRemote = const Remote(
name: RemoteName.upstream, url: EngineRepository.defaultUpstream),
super.upstreamRemote = const Remote.upstream(EngineRepository.defaultUpstream),
super.localUpstream,
super.previousCheckoutLocation,
super.mirrorRemote,
Expand Down Expand Up @@ -847,9 +837,7 @@ class EngineRepository extends Repository {
return EngineRepository(
checkouts,
name: cloneName,
upstreamRemote: Remote(
name: RemoteName.upstream,
url: 'file://${(await checkoutDirectory).path}/'),
upstreamRemote: Remote.upstream('file://${(await checkoutDirectory).path}/'),
);
}
}
Expand Down
20 changes: 4 additions & 16 deletions dev/conductor/core/lib/src/start.dart
Original file line number Diff line number Diff line change
Expand Up @@ -218,26 +218,14 @@ class StartContext extends Context {
engine = EngineRepository(
checkouts,
initialRef: 'upstream/$candidateBranch',
upstreamRemote: Remote(
name: RemoteName.upstream,
url: engineUpstream,
),
mirrorRemote: Remote(
name: RemoteName.mirror,
url: engineMirror,
),
upstreamRemote: Remote.upstream(engineUpstream),
mirrorRemote: Remote.mirror(engineMirror),
),
framework = FrameworkRepository(
checkouts,
initialRef: 'upstream/$candidateBranch',
upstreamRemote: Remote(
name: RemoteName.upstream,
url: frameworkUpstream,
),
mirrorRemote: Remote(
name: RemoteName.mirror,
url: frameworkMirror,
),
upstreamRemote: Remote.upstream(frameworkUpstream),
mirrorRemote: Remote.mirror(frameworkMirror),
);

final String candidateBranch;
Expand Down
2 changes: 1 addition & 1 deletion dev/conductor/core/test/next_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ class _TestRepository extends Repository {
name: name,
requiredLocalBranches: <String>[],
stdio: checkouts.stdio,
upstreamRemote: const Remote(name: RemoteName.upstream, url: '[email protected]:upstream/repo.git'),
upstreamRemote: const Remote.upstream('[email protected]:upstream/repo.git'),
);

@override
Expand Down
5 changes: 1 addition & 4 deletions dev/conductor/core/test/packages_autoroller_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ void main() {
);
framework = FrameworkRepository(
checkouts,
mirrorRemote: const Remote(
name: RemoteName.mirror,
url: mirrorUrl,
),
mirrorRemote: const Remote.mirror(mirrorUrl),
);

autoroller = PackageAutoroller(
Expand Down

0 comments on commit 979e475

Please sign in to comment.