Skip to content

Commit c84d037

Browse files
devoncarewCommit Queue
authored and
Commit Queue
committed
[deps] update the rev script to handle 'main' branches
Also rev package:csslib and package:html. csslib (https://github.com/dart-lang/csslib/compare/7054945..f33d632): f33d632 2023-01-28 Devon Carew switch to using package:dart_flutter_team_lints (#161) c0097a0 2023-01-28 Devon Carew Update README.md (#158) 0d985fb 2023-01-28 dependabot[bot] Bump dart-lang/setup-dart from 1.3 to 1.4 (#164) 56d1152 2023-01-28 dependabot[bot] Bump actions/checkout from 3.2.0 to 3.3.0 (#163) 46d2c57 2023-01-28 Devon Carew Update test-package.yml (#165) a7d17bc 2023-01-26 Kevin Moore all the cleanup (#155) html (https://github.com/dart-lang/html/compare/3dd00b0..f118e00): f118e00 2023-01-30 Devon Carew lint with dart_flutter_team_lints (#201) 52d9185 2023-01-30 Devon Carew updates from #158 (#202) 71d3e71 2023-01-30 Ron Booth fixed issue #157 (querySelector fails), and added test for it (#158) 9ab8b28 2023-01-30 dependabot[bot] Bump actions/checkout from 3.2.0 to 3.3.0 (#200) fe3fbf6 2023-01-30 dependabot[bot] Bump dart-lang/setup-dart from 1.3 to 1.4 (#199) 776daf5 2023-01-30 Devon Carew Update test-package.yml (#198) a5be27f 2023-01-27 Devon Carew finish work for avoid_dynamic_calls (#196) Change-Id: If03552028f30b8dfd6a227674aa161e43a05e11f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280129 Reviewed-by: William Hesse <whesse@google.com> Reviewed-by: Sigurd Meldgaard <sigurdm@google.com> Commit-Queue: Devon Carew <devoncarew@google.com>
1 parent 134b2dc commit c84d037

File tree

3 files changed

+39
-7
lines changed

3 files changed

+39
-7
lines changed

DEPS

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ vars = {
123123
"collection_rev": "a566328f793cd26c52f3fa4010fe331bb8700383",
124124
"convert_rev": "20d136c2fa4edc229fc3d7684bbeb8df5105580b",
125125
"crypto_rev": "f854f2fa730acb107aa41ebe431403081f7161e4",
126-
"csslib_rev": "7054945b62bd83c4c7a0fab693fa73c3f137c202",
126+
"csslib_rev": "f33d63211f77e2a895b90bcf22508ab7a0af4466",
127127
# Note: Updates to dart_style have to be coordinated with the infrastructure
128128
# team so that the internal formatter `tools/sdks/dart-sdk/bin/dart format`
129129
# matches the version here. Please follow this process to make updates:
@@ -140,7 +140,7 @@ vars = {
140140
"file_rev": "b768f79dcd104a5feabafab47101c4355b71cd8f",
141141
"fixnum_rev": "71f0d4d16054e6be7d8e22bdb3b082b9f82061be",
142142
"glob_rev": "4579281741e59e2e4ad02a197e0b1f4d6558dede",
143-
"html_rev": "3dd00b0ca99e222697e6b6dc653774dc877da420",
143+
"html_rev": "f118e004dfe68a4d101246106e775c0231efb79a",
144144
"http_rev": "092bb2d5ed1d522c55ef6781a469ba1e53cee2a8",
145145
"http_multi_server_rev": "cce50802b66d33f703f82b3189988aa8e51976ac",
146146
"http_parser_rev": "6f73e4a399df013ded8f4c81f151d122b36d361b",

tools/manage_deps.dart

+17-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ This will:
117117
if (argResults.wasParsed('target'))
118118
argResults['target']
119119
else
120-
'origin/HEAD',
120+
'origin/${defaultBranchTarget(pkgDir)}',
121121
], workingDirectory: pkgDir, explanation: 'Finding sha-id');
122122

123123
final target = gitRevParseResult.first;
@@ -265,3 +265,19 @@ int runProcessForExitCode(List<String> cmd,
265265
stdout.writeln(' => ${result.exitCode}');
266266
return result.exitCode;
267267
}
268+
269+
String defaultBranchTarget(String dir) {
270+
var branchNames = Directory(p.join(dir, '.git', 'refs', 'heads'))
271+
.listSync()
272+
.whereType<File>()
273+
.map((f) => p.basename(f.path))
274+
.toSet();
275+
276+
for (var name in ['main', 'master']) {
277+
if (branchNames.contains(name)) {
278+
return name;
279+
}
280+
}
281+
282+
return 'HEAD';
283+
}

tools/rev_sdk_deps.dart

+20-4
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ class GitHelper {
114114
}
115115

116116
Future<String> findLatestUnsyncedCommit() async {
117-
// git log HEAD..origin --format=%H -1
117+
// git log ..origin/<default-branch> --format=%H -1
118118

119119
var result = await exec(
120120
[
121121
'git',
122122
'log',
123-
'HEAD..origin',
123+
'..origin/$defaultBranchName',
124124
'--format=%H',
125125
'-1',
126126
],
@@ -130,18 +130,34 @@ class GitHelper {
130130
}
131131

132132
Future<String> calculateUnsyncedCommits() async {
133-
// git log HEAD..origin --format="%h %ad %aN %s" -1
133+
// git log ..origin/<default-branch> --format="%h %ad %aN %s" -1
134134
var result = await exec(
135135
[
136136
'git',
137137
'log',
138-
'HEAD..origin',
138+
'..origin/$defaultBranchName',
139139
'--format=%h %ad %aN %s',
140140
],
141141
cwd: dir,
142142
);
143143
return result.trim();
144144
}
145+
146+
String get defaultBranchName {
147+
var branchNames = Directory(path.join(dir, '.git', 'refs', 'heads'))
148+
.listSync()
149+
.whereType<File>()
150+
.map((f) => path.basename(f.path))
151+
.toSet();
152+
153+
for (var name in ['main', 'master']) {
154+
if (branchNames.contains(name)) {
155+
return name;
156+
}
157+
}
158+
159+
return 'origin';
160+
}
145161
}
146162

147163
class GClientHelper {

0 commit comments

Comments
 (0)