Skip to content

Commit

Permalink
[deps] update the rev script to handle 'main' branches
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
devoncarew authored and Commit Queue committed Feb 6, 2023
1 parent 134b2dc commit c84d037
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 7 deletions.
4 changes: 2 additions & 2 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ vars = {
"collection_rev": "a566328f793cd26c52f3fa4010fe331bb8700383",
"convert_rev": "20d136c2fa4edc229fc3d7684bbeb8df5105580b",
"crypto_rev": "f854f2fa730acb107aa41ebe431403081f7161e4",
"csslib_rev": "7054945b62bd83c4c7a0fab693fa73c3f137c202",
"csslib_rev": "f33d63211f77e2a895b90bcf22508ab7a0af4466",
# Note: Updates to dart_style have to be coordinated with the infrastructure
# team so that the internal formatter `tools/sdks/dart-sdk/bin/dart format`
# matches the version here. Please follow this process to make updates:
Expand All @@ -140,7 +140,7 @@ vars = {
"file_rev": "b768f79dcd104a5feabafab47101c4355b71cd8f",
"fixnum_rev": "71f0d4d16054e6be7d8e22bdb3b082b9f82061be",
"glob_rev": "4579281741e59e2e4ad02a197e0b1f4d6558dede",
"html_rev": "3dd00b0ca99e222697e6b6dc653774dc877da420",
"html_rev": "f118e004dfe68a4d101246106e775c0231efb79a",
"http_rev": "092bb2d5ed1d522c55ef6781a469ba1e53cee2a8",
"http_multi_server_rev": "cce50802b66d33f703f82b3189988aa8e51976ac",
"http_parser_rev": "6f73e4a399df013ded8f4c81f151d122b36d361b",
Expand Down
18 changes: 17 additions & 1 deletion tools/manage_deps.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ This will:
if (argResults.wasParsed('target'))
argResults['target']
else
'origin/HEAD',
'origin/${defaultBranchTarget(pkgDir)}',
], workingDirectory: pkgDir, explanation: 'Finding sha-id');

final target = gitRevParseResult.first;
Expand Down Expand Up @@ -265,3 +265,19 @@ int runProcessForExitCode(List<String> cmd,
stdout.writeln(' => ${result.exitCode}');
return result.exitCode;
}

String defaultBranchTarget(String dir) {
var branchNames = Directory(p.join(dir, '.git', 'refs', 'heads'))
.listSync()
.whereType<File>()
.map((f) => p.basename(f.path))
.toSet();

for (var name in ['main', 'master']) {
if (branchNames.contains(name)) {
return name;
}
}

return 'HEAD';
}
24 changes: 20 additions & 4 deletions tools/rev_sdk_deps.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ class GitHelper {
}

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

var result = await exec(
[
'git',
'log',
'HEAD..origin',
'..origin/$defaultBranchName',
'--format=%H',
'-1',
],
Expand All @@ -130,18 +130,34 @@ class GitHelper {
}

Future<String> calculateUnsyncedCommits() async {
// git log HEAD..origin --format="%h %ad %aN %s" -1
// git log ..origin/<default-branch> --format="%h %ad %aN %s" -1
var result = await exec(
[
'git',
'log',
'HEAD..origin',
'..origin/$defaultBranchName',
'--format=%h %ad %aN %s',
],
cwd: dir,
);
return result.trim();
}

String get defaultBranchName {
var branchNames = Directory(path.join(dir, '.git', 'refs', 'heads'))
.listSync()
.whereType<File>()
.map((f) => path.basename(f.path))
.toSet();

for (var name in ['main', 'master']) {
if (branchNames.contains(name)) {
return name;
}
}

return 'origin';
}
}

class GClientHelper {
Expand Down

0 comments on commit c84d037

Please sign in to comment.