From 353e27a6dce6ba5140264f9b63c531be4b16aed0 Mon Sep 17 00:00:00 2001 From: Moritz Date: Fri, 11 Oct 2024 19:32:37 +0200 Subject: [PATCH 01/17] Update instructions for trebuchet --- pkgs/trebuchet/bin/trebuchet.dart | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/pkgs/trebuchet/bin/trebuchet.dart b/pkgs/trebuchet/bin/trebuchet.dart index 60340417..30f2535d 100644 --- a/pkgs/trebuchet/bin/trebuchet.dart +++ b/pkgs/trebuchet/bin/trebuchet.dart @@ -150,7 +150,7 @@ class Trebuchet { '--allow-unrelated-histories', '${input}_package/$branchName', '-m', - 'Merge package:$input into shared $target repository' + 'Merge package:$input into the $target monorepo' ], ); @@ -165,16 +165,26 @@ class Trebuchet { } final remainingSteps = [ - 'move and fix workflow files', if (!shouldPush) 'run `git push --set-upstream origin merge-$input-package` in the monorepo directory', - "enable 'Allow merge commits' in GitHub settings; merge the PR with 'Create a merge commit'; disable 'Allow merge commits'", - "push tags to GitHub using `git tag --list '$input*' | xargs git push origin`", - 'follow up with a PR adding links to the top-level readme table', - 'transfer issues by running `dart run pkgs/repo_manage/bin/report.dart transfer-issues --source-repo dart-lang/$input --target-repo dart-lang/$target --add-label package:$input --apply-changes`', - 'update the auto-publishing settings on pub.dev/packages/$input', - "add a commit to https://github.com/dart-lang/$input/ with it's readme pointing to the monorepo", - 'archive https://github.com/dart-lang/$input/', + 'Move and fix workflow files and badges in the README.md', + 'Update pubspec.yaml to point to the new repository', + 'Rev the version of the package, so that pub.dev points to the correct site', + 'Add the package to the top-level readme of the monorepo', + "Merge the PR with 'Create a merge commit', enable `Allow merge commits` if not yet enabled on this repository", + 'Update the auto-publishing settings on https://pub.dev/packages/$input/admin', + ''' +Add the following text to https://github.com/dart-lang/$input/:' + +``` +> [!IMPORTANT] +> This repo has moved to https://github.com/dart-lang/$target/tree/main/pkgs/$input +``` +''', + 'Publish' + "Push tags to GitHub using `git tag --list '$input*' | xargs git push origin`", + 'Transfer issues by running `dart run pkgs/repo_manage/bin/report.dart transfer-issues --source-repo dart-lang/$input --target-repo dart-lang/$target --add-label package:$input --apply-changes`', + 'Archive https://github.com/dart-lang/$input/', ]; print('DONE!'); From 9811fc7bcf9d46723f8b0732c68366a51c7dd7fa Mon Sep 17 00:00:00 2001 From: Moritz Date: Fri, 11 Oct 2024 19:37:29 +0200 Subject: [PATCH 02/17] Fix typo --- pkgs/trebuchet/bin/trebuchet.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/trebuchet/bin/trebuchet.dart b/pkgs/trebuchet/bin/trebuchet.dart index 30f2535d..c9c1680e 100644 --- a/pkgs/trebuchet/bin/trebuchet.dart +++ b/pkgs/trebuchet/bin/trebuchet.dart @@ -181,8 +181,7 @@ Add the following text to https://github.com/dart-lang/$input/:' > This repo has moved to https://github.com/dart-lang/$target/tree/main/pkgs/$input ``` ''', - 'Publish' - "Push tags to GitHub using `git tag --list '$input*' | xargs git push origin`", + "Push tags to GitHub using `git tag --list '$input*' | xargs git push origin`", 'Transfer issues by running `dart run pkgs/repo_manage/bin/report.dart transfer-issues --source-repo dart-lang/$input --target-repo dart-lang/$target --add-label package:$input --apply-changes`', 'Archive https://github.com/dart-lang/$input/', ]; From 32d1c1533aa4e6d2bfbc015a84bd6ebb856452ac Mon Sep 17 00:00:00 2001 From: Moritz Date: Fri, 11 Oct 2024 19:38:03 +0200 Subject: [PATCH 03/17] Add line --- pkgs/trebuchet/bin/trebuchet.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/trebuchet/bin/trebuchet.dart b/pkgs/trebuchet/bin/trebuchet.dart index c9c1680e..2679a1e0 100644 --- a/pkgs/trebuchet/bin/trebuchet.dart +++ b/pkgs/trebuchet/bin/trebuchet.dart @@ -181,6 +181,7 @@ Add the following text to https://github.com/dart-lang/$input/:' > This repo has moved to https://github.com/dart-lang/$target/tree/main/pkgs/$input ``` ''', + 'Publish using the autopublish workflow', "Push tags to GitHub using `git tag --list '$input*' | xargs git push origin`", 'Transfer issues by running `dart run pkgs/repo_manage/bin/report.dart transfer-issues --source-repo dart-lang/$input --target-repo dart-lang/$target --add-label package:$input --apply-changes`', 'Archive https://github.com/dart-lang/$input/', From 1f30ecd86532fd973336840dbd81c91d60bdbe8c Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 14 Oct 2024 13:15:00 +0200 Subject: [PATCH 04/17] Update pkgs/trebuchet/bin/trebuchet.dart Co-authored-by: Devon Carew --- pkgs/trebuchet/bin/trebuchet.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/trebuchet/bin/trebuchet.dart b/pkgs/trebuchet/bin/trebuchet.dart index 2679a1e0..e14fc8df 100644 --- a/pkgs/trebuchet/bin/trebuchet.dart +++ b/pkgs/trebuchet/bin/trebuchet.dart @@ -171,7 +171,7 @@ class Trebuchet { 'Update pubspec.yaml to point to the new repository', 'Rev the version of the package, so that pub.dev points to the correct site', 'Add the package to the top-level readme of the monorepo', - "Merge the PR with 'Create a merge commit', enable `Allow merge commits` if not yet enabled on this repository", + "**Important!** Merge the PR with 'Create a merge commit' (enabling then disabling the `Allow merge commits` admin setting)", 'Update the auto-publishing settings on https://pub.dev/packages/$input/admin', ''' Add the following text to https://github.com/dart-lang/$input/:' From 188cbc3472ab3f2210decb0466bce4ecb69274e7 Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 14 Oct 2024 13:20:59 +0200 Subject: [PATCH 05/17] Add comment for PR closing --- pkgs/trebuchet/bin/trebuchet.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/trebuchet/bin/trebuchet.dart b/pkgs/trebuchet/bin/trebuchet.dart index e14fc8df..f9b4d467 100644 --- a/pkgs/trebuchet/bin/trebuchet.dart +++ b/pkgs/trebuchet/bin/trebuchet.dart @@ -183,6 +183,11 @@ Add the following text to https://github.com/dart-lang/$input/:' ''', 'Publish using the autopublish workflow', "Push tags to GitHub using `git tag --list '$input*' | xargs git push origin`", + ''' +Close open PRs in dart-lang/$input with the following message: + +Closing as the [dart-lang/$input](https://github.com/dart-lang/$input) repository is merged into the [dart-lang/$target](https://github.com/dart-lang/$target) monorepo. Please re-open this PR there! + ''', 'Transfer issues by running `dart run pkgs/repo_manage/bin/report.dart transfer-issues --source-repo dart-lang/$input --target-repo dart-lang/$target --add-label package:$input --apply-changes`', 'Archive https://github.com/dart-lang/$input/', ]; From dc24a2896c58b3f69897c9e71da1f10d4feb3fce Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 14 Oct 2024 13:27:03 +0200 Subject: [PATCH 06/17] Add changelog --- pkgs/firehose/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/firehose/CHANGELOG.md b/pkgs/firehose/CHANGELOG.md index 6890c0d0..efde57c3 100644 --- a/pkgs/firehose/CHANGELOG.md +++ b/pkgs/firehose/CHANGELOG.md @@ -2,6 +2,7 @@ - Remove the `version` pubspec checks (these largely duplicate the feedback provided by publishing automation). +- Set minimum SDK version to `3.2.0` because of the `dart_apitool` dependency. ## 0.9.3 From 57baab7d76745833633cc11963af2b45a8ca0b4f Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 14 Oct 2024 13:34:32 +0200 Subject: [PATCH 07/17] Rev firehose to 3.3 --- pkgs/firehose/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/firehose/CHANGELOG.md b/pkgs/firehose/CHANGELOG.md index efde57c3..9933fd96 100644 --- a/pkgs/firehose/CHANGELOG.md +++ b/pkgs/firehose/CHANGELOG.md @@ -2,7 +2,7 @@ - Remove the `version` pubspec checks (these largely duplicate the feedback provided by publishing automation). -- Set minimum SDK version to `3.2.0` because of the `dart_apitool` dependency. +- Set minimum SDK version to `3.3.0` because of the `dart_apitool` dependency. ## 0.9.3 From 75af17801a0949310190cf7b036763659e18a7d0 Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 14 Oct 2024 13:39:50 +0200 Subject: [PATCH 08/17] Rev firehose to 3.5 --- pkgs/firehose/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/firehose/CHANGELOG.md b/pkgs/firehose/CHANGELOG.md index 9933fd96..632fb5e9 100644 --- a/pkgs/firehose/CHANGELOG.md +++ b/pkgs/firehose/CHANGELOG.md @@ -2,7 +2,7 @@ - Remove the `version` pubspec checks (these largely duplicate the feedback provided by publishing automation). -- Set minimum SDK version to `3.3.0` because of the `dart_apitool` dependency. +- Set minimum SDK version to `3.5.0` because of the `dart_apitool` dependency. ## 0.9.3 From 01b2f504ca142e9cdb4c78599a4e68929664683e Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 14 Oct 2024 14:08:48 +0200 Subject: [PATCH 09/17] Add code ticks --- pkgs/trebuchet/bin/trebuchet.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/trebuchet/bin/trebuchet.dart b/pkgs/trebuchet/bin/trebuchet.dart index f9b4d467..708d6d92 100644 --- a/pkgs/trebuchet/bin/trebuchet.dart +++ b/pkgs/trebuchet/bin/trebuchet.dart @@ -186,7 +186,7 @@ Add the following text to https://github.com/dart-lang/$input/:' ''' Close open PRs in dart-lang/$input with the following message: -Closing as the [dart-lang/$input](https://github.com/dart-lang/$input) repository is merged into the [dart-lang/$target](https://github.com/dart-lang/$target) monorepo. Please re-open this PR there! +`Closing as the [dart-lang/$input](https://github.com/dart-lang/$input) repository is merged into the [dart-lang/$target](https://github.com/dart-lang/$target) monorepo. Please re-open this PR there!` ''', 'Transfer issues by running `dart run pkgs/repo_manage/bin/report.dart transfer-issues --source-repo dart-lang/$input --target-repo dart-lang/$target --add-label package:$input --apply-changes`', 'Archive https://github.com/dart-lang/$input/', From 80e737502e94854646788c57d1ec95d49e490e68 Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 14 Oct 2024 16:26:16 +0200 Subject: [PATCH 10/17] Add different default label --- pkgs/repo_manage/lib/issue_transfer.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/repo_manage/lib/issue_transfer.dart b/pkgs/repo_manage/lib/issue_transfer.dart index f5b5bf2b..9b008e5a 100644 --- a/pkgs/repo_manage/lib/issue_transfer.dart +++ b/pkgs/repo_manage/lib/issue_transfer.dart @@ -42,13 +42,13 @@ class TransferIssuesCommand extends ReportCommand { argParser.addOption( 'add-label', help: 'Add a label to all transferred issues.', - valueHelp: 'package:foo', + valueHelp: 'package-foo', ); } @override String get invocation => - '${super.invocation} --source-repo repo-org/old-repo-name --target-repo repo-org/new-repo-name --add-label pkg:old-repo-name'; + '${super.invocation} --source-repo repo-org/old-repo-name --target-repo repo-org/new-repo-name --add-label package-old-repo-name'; @override Future run() async { From c111addf706563eed1cee50fa468333ea790fa28 Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 14 Oct 2024 16:57:27 +0200 Subject: [PATCH 11/17] Fix default label --- pkgs/trebuchet/bin/trebuchet.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/trebuchet/bin/trebuchet.dart b/pkgs/trebuchet/bin/trebuchet.dart index 708d6d92..eace909d 100644 --- a/pkgs/trebuchet/bin/trebuchet.dart +++ b/pkgs/trebuchet/bin/trebuchet.dart @@ -188,7 +188,7 @@ Close open PRs in dart-lang/$input with the following message: `Closing as the [dart-lang/$input](https://github.com/dart-lang/$input) repository is merged into the [dart-lang/$target](https://github.com/dart-lang/$target) monorepo. Please re-open this PR there!` ''', - 'Transfer issues by running `dart run pkgs/repo_manage/bin/report.dart transfer-issues --source-repo dart-lang/$input --target-repo dart-lang/$target --add-label package:$input --apply-changes`', + 'Transfer issues by running `dart run pkgs/repo_manage/bin/report.dart transfer-issues --source-repo dart-lang/$input --target-repo dart-lang/$target --add-label package-$input --apply-changes`', 'Archive https://github.com/dart-lang/$input/', ]; From b83c4c22fb7a6b0ea4755de23305e453100c0073 Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 15 Oct 2024 12:12:32 +0200 Subject: [PATCH 12/17] Switch back to colon --- pkgs/repo_manage/lib/issue_transfer.dart | 4 ++-- pkgs/trebuchet/bin/trebuchet.dart | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/repo_manage/lib/issue_transfer.dart b/pkgs/repo_manage/lib/issue_transfer.dart index 9b008e5a..030dd760 100644 --- a/pkgs/repo_manage/lib/issue_transfer.dart +++ b/pkgs/repo_manage/lib/issue_transfer.dart @@ -42,13 +42,13 @@ class TransferIssuesCommand extends ReportCommand { argParser.addOption( 'add-label', help: 'Add a label to all transferred issues.', - valueHelp: 'package-foo', + valueHelp: 'package:foo', ); } @override String get invocation => - '${super.invocation} --source-repo repo-org/old-repo-name --target-repo repo-org/new-repo-name --add-label package-old-repo-name'; + '${super.invocation} --source-repo repo-org/old-repo-name --target-repo repo-org/new-repo-name --add-label package:old-repo-name'; @override Future run() async { diff --git a/pkgs/trebuchet/bin/trebuchet.dart b/pkgs/trebuchet/bin/trebuchet.dart index eace909d..708d6d92 100644 --- a/pkgs/trebuchet/bin/trebuchet.dart +++ b/pkgs/trebuchet/bin/trebuchet.dart @@ -188,7 +188,7 @@ Close open PRs in dart-lang/$input with the following message: `Closing as the [dart-lang/$input](https://github.com/dart-lang/$input) repository is merged into the [dart-lang/$target](https://github.com/dart-lang/$target) monorepo. Please re-open this PR there!` ''', - 'Transfer issues by running `dart run pkgs/repo_manage/bin/report.dart transfer-issues --source-repo dart-lang/$input --target-repo dart-lang/$target --add-label package-$input --apply-changes`', + 'Transfer issues by running `dart run pkgs/repo_manage/bin/report.dart transfer-issues --source-repo dart-lang/$input --target-repo dart-lang/$target --add-label package:$input --apply-changes`', 'Archive https://github.com/dart-lang/$input/', ]; From 05d21f340bfd5b42d56c9324434bfa534b540d5f Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 16 Oct 2024 09:15:30 +0200 Subject: [PATCH 13/17] Add issue template --- pkgs/trebuchet/bin/trebuchet.dart | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkgs/trebuchet/bin/trebuchet.dart b/pkgs/trebuchet/bin/trebuchet.dart index 708d6d92..79667c12 100644 --- a/pkgs/trebuchet/bin/trebuchet.dart +++ b/pkgs/trebuchet/bin/trebuchet.dart @@ -150,7 +150,7 @@ class Trebuchet { '--allow-unrelated-histories', '${input}_package/$branchName', '-m', - 'Merge package:$input into the $target monorepo' + 'Merge package:$input into the $target monorepo', ], ); @@ -171,6 +171,16 @@ class Trebuchet { 'Update pubspec.yaml to point to the new repository', 'Rev the version of the package, so that pub.dev points to the correct site', 'Add the package to the top-level readme of the monorepo', + ''' +Add an issue template at `.github/ISSUE_TEMPLATE/$input.md` +``` +--- +name: "package:$input" +about: "Create a bug or file a feature request against package:$input." +labels: "package:$input" +--- +``` +''', "**Important!** Merge the PR with 'Create a merge commit' (enabling then disabling the `Allow merge commits` admin setting)", 'Update the auto-publishing settings on https://pub.dev/packages/$input/admin', ''' From ce44b151698d3e83372bb3e167836abfb0414bb5 Mon Sep 17 00:00:00 2001 From: Moritz Date: Thu, 17 Oct 2024 15:43:38 +0200 Subject: [PATCH 14/17] More fixes --- pkgs/trebuchet/README.md | 3 +- pkgs/trebuchet/bin/trebuchet.dart | 89 ++++++++++++++++++++++++------- pkgs/trebuchet/pubspec.yaml | 1 + 3 files changed, 74 insertions(+), 19 deletions(-) diff --git a/pkgs/trebuchet/README.md b/pkgs/trebuchet/README.md index e3df998b..724c1d90 100644 --- a/pkgs/trebuchet/README.md +++ b/pkgs/trebuchet/README.md @@ -7,7 +7,8 @@ This is a tool to move existing packages into monorepos. ```bash dart run bin/trebuchet.dart \ --input-name coverage \ - --branch-name main \ + --input-branch-name main \ + --target-branch-name main \ --input-path ~/projects/coverage/ \ --target tools \ --target-path ~/projects/tools/ \ diff --git a/pkgs/trebuchet/bin/trebuchet.dart b/pkgs/trebuchet/bin/trebuchet.dart index 79667c12..d891121b 100644 --- a/pkgs/trebuchet/bin/trebuchet.dart +++ b/pkgs/trebuchet/bin/trebuchet.dart @@ -8,6 +8,7 @@ import 'dart:io'; import 'package:args/args.dart'; import 'package:path/path.dart' as p; +import 'package:pubspec_parse/pubspec_parse.dart'; Future main(List arguments) async { final argParser = ArgParser() @@ -28,7 +29,12 @@ Future main(List arguments) async { help: 'Path to the mono-repo', ) ..addOption( - 'branch-name', + 'input-branch-name', + help: 'The name of the main branch on the input repo', + defaultsTo: 'main', + ) + ..addOption( + 'target-branch-name', help: 'The name of the main branch on the input repo', defaultsTo: 'main', ) @@ -52,7 +58,8 @@ Future main(List arguments) async { String inputPath; String target; String targetPath; - String branchName; + String inputBranchName; + String targetBranchName; String gitFilterRepo; bool dryRun; try { @@ -66,7 +73,8 @@ Future main(List arguments) async { inputPath = parsed.option('input-path')!; target = parsed.option('target')!; targetPath = parsed.option('target-path')!; - branchName = parsed.option('branch-name')!; + inputBranchName = parsed.option('input-branch-name')!; + targetBranchName = parsed.option('target-branch-name')!; gitFilterRepo = parsed.option('git-filter-repo')!; dryRun = parsed.flag('dry-run'); } catch (e) { @@ -81,7 +89,8 @@ Future main(List arguments) async { inputPath: inputPath, target: target, targetPath: targetPath, - branchName: branchName, + inputBranchName: inputBranchName, + targetBranchName: targetBranchName, gitFilterRepo: gitFilterRepo, dryRun: dryRun, ); @@ -94,7 +103,8 @@ class Trebuchet { final String inputPath; final String target; final String targetPath; - final String branchName; + final String inputBranchName; + final String targetBranchName; final String gitFilterRepo; final bool dryRun; @@ -103,7 +113,8 @@ class Trebuchet { required this.inputPath, required this.target, required this.targetPath, - required this.branchName, + required this.inputBranchName, + required this.targetBranchName, required this.gitFilterRepo, required this.dryRun, }); @@ -148,12 +159,52 @@ class Trebuchet { [ 'merge', '--allow-unrelated-histories', - '${input}_package/$branchName', + '${input}_package/$inputBranchName', '-m', 'Merge package:$input into the $target monorepo', ], ); + print('Replace URI in pubspec'); + Pubspec? pubspec; + if (!dryRun) { + final pubspecFile = + File(p.join(targetPath, 'pkgs', input, 'pubspec.yaml')); + final pubspecContents = await pubspecFile.readAsString(); + pubspec = Pubspec.parse(pubspecContents); + final newPubspecContents = pubspecContents.replaceFirst( + 'repository: https://github.com/dart-lang/$input', + 'repository: https://github.com/dart-lang/$target/tree/$targetBranchName/pkgs/$input', + ); + await pubspecFile.writeAsString(newPubspecContents); + } + + print('Add issue template'); + final issueTemplateFile = + File(p.join(targetPath, '.github', 'ISSUE_TEMPLATE', '$input.md')); + final issueTemplateContents = ''' +--- +name: "package:$input" +about: "Create a bug or file a feature request against package:$input." +labels: "package:$input" +---'''; + if (!dryRun) { + await issueTemplateFile.create(recursive: true); + await issueTemplateFile.writeAsString(issueTemplateContents); + } + + print('Remove CONTRIBUTING.md'); + if (!dryRun) { + final contributingFile = + File(p.join(targetPath, 'pkgs', input, 'CONTRIBUTING.md')); + if (await contributingFile.exists()) await contributingFile.delete(); + } + + print('Committing changes'); + await runProcess('git', ['add', '.']); + await runProcess( + 'git', ['commit', '-m', 'Add issue template and other fixes']); + final shouldPush = getInput('Push to remote? (y/N)'); if (shouldPush) { @@ -167,18 +218,18 @@ class Trebuchet { final remainingSteps = [ if (!shouldPush) 'run `git push --set-upstream origin merge-$input-package` in the monorepo directory', - 'Move and fix workflow files and badges in the README.md', - 'Update pubspec.yaml to point to the new repository', + 'Move and fix workflow files, labeler.yaml, and badges in the README.md', 'Rev the version of the package, so that pub.dev points to the correct site', - 'Add the package to the top-level readme of the monorepo', ''' -Add an issue template at `.github/ISSUE_TEMPLATE/$input.md` +Add a line to the changelog: ``` ---- -name: "package:$input" -about: "Create a bug or file a feature request against package:$input." -labels: "package:$input" ---- +* Move to `dart-lang/$target` monorepo. +``` +''', + ''' +Add the package to the top-level readme of the monorepo: +``` +| [$input](pkgs/$input/) | ${pubspec?.description ?? ''} | [![pub package](https://img.shields.io/pub/v/$input.svg)](https://pub.dev/packages/$input) | ``` ''', "**Important!** Merge the PR with 'Create a merge commit' (enabling then disabling the `Allow merge commits` admin setting)", @@ -188,7 +239,7 @@ Add the following text to https://github.com/dart-lang/$input/:' ``` > [!IMPORTANT] -> This repo has moved to https://github.com/dart-lang/$target/tree/main/pkgs/$input +> This repo has moved to https://github.com/dart-lang/$target/tree/$targetBranchName/pkgs/$input ``` ''', 'Publish using the autopublish workflow', @@ -196,7 +247,9 @@ Add the following text to https://github.com/dart-lang/$input/:' ''' Close open PRs in dart-lang/$input with the following message: -`Closing as the [dart-lang/$input](https://github.com/dart-lang/$input) repository is merged into the [dart-lang/$target](https://github.com/dart-lang/$target) monorepo. Please re-open this PR there!` +``` +Closing as the [dart-lang/$input](https://github.com/dart-lang/$input) repository is merged into the [dart-lang/$target](https://github.com/dart-lang/$target) monorepo. Please re-open this PR there! +``` ''', 'Transfer issues by running `dart run pkgs/repo_manage/bin/report.dart transfer-issues --source-repo dart-lang/$input --target-repo dart-lang/$target --add-label package:$input --apply-changes`', 'Archive https://github.com/dart-lang/$input/', diff --git a/pkgs/trebuchet/pubspec.yaml b/pkgs/trebuchet/pubspec.yaml index b245a201..417a2d02 100644 --- a/pkgs/trebuchet/pubspec.yaml +++ b/pkgs/trebuchet/pubspec.yaml @@ -9,6 +9,7 @@ environment: dependencies: args: ^2.5.0 path: ^1.9.0 + pubspec_parse: ^1.3.0 dev_dependencies: dart_flutter_team_lints: ^3.2.0 From 642c9ba76746fb6e5dd2b5bb8de4e2c107debc54 Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 28 Oct 2024 10:04:05 +0100 Subject: [PATCH 15/17] Slight change --- pkgs/trebuchet/bin/trebuchet.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/trebuchet/bin/trebuchet.dart b/pkgs/trebuchet/bin/trebuchet.dart index d891121b..96bb893b 100644 --- a/pkgs/trebuchet/bin/trebuchet.dart +++ b/pkgs/trebuchet/bin/trebuchet.dart @@ -251,7 +251,9 @@ Close open PRs in dart-lang/$input with the following message: Closing as the [dart-lang/$input](https://github.com/dart-lang/$input) repository is merged into the [dart-lang/$target](https://github.com/dart-lang/$target) monorepo. Please re-open this PR there! ``` ''', - 'Transfer issues by running `dart run pkgs/repo_manage/bin/report.dart transfer-issues --source-repo dart-lang/$input --target-repo dart-lang/$target --add-label package:$input --apply-changes`', + '''Transfer issues by running +```dart run pkgs/repo_manage/bin/report.dart transfer-issues --source-repo dart-lang/$input --target-repo dart-lang/$target --add-label package:$input --apply-changes``` +''', 'Archive https://github.com/dart-lang/$input/', ]; From bcb2379d2e009590061edc4194550ae2ac622956 Mon Sep 17 00:00:00 2001 From: Moritz Date: Mon, 28 Oct 2024 10:04:47 +0100 Subject: [PATCH 16/17] Slight changes --- pkgs/trebuchet/bin/trebuchet.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/trebuchet/bin/trebuchet.dart b/pkgs/trebuchet/bin/trebuchet.dart index 96bb893b..7cd0a771 100644 --- a/pkgs/trebuchet/bin/trebuchet.dart +++ b/pkgs/trebuchet/bin/trebuchet.dart @@ -243,7 +243,9 @@ Add the following text to https://github.com/dart-lang/$input/:' ``` ''', 'Publish using the autopublish workflow', - "Push tags to GitHub using `git tag --list '$input*' | xargs git push origin`", + """Push tags to GitHub using +```git tag --list '$input*' | xargs git push origin``` +""", ''' Close open PRs in dart-lang/$input with the following message: From 8c5ab39f419153503486baa8d5e1f2516047b5a0 Mon Sep 17 00:00:00 2001 From: Moritz Date: Thu, 31 Oct 2024 14:26:38 +0100 Subject: [PATCH 17/17] Remove issuenumbers --- pkgs/repo_manage/lib/issue_transfer.dart | 75 ++++++++++-------------- 1 file changed, 31 insertions(+), 44 deletions(-) diff --git a/pkgs/repo_manage/lib/issue_transfer.dart b/pkgs/repo_manage/lib/issue_transfer.dart index 030dd760..fa624a7f 100644 --- a/pkgs/repo_manage/lib/issue_transfer.dart +++ b/pkgs/repo_manage/lib/issue_transfer.dart @@ -14,36 +14,32 @@ class TransferIssuesCommand extends ReportCommand { TransferIssuesCommand() : super('transfer-issues', 'Bulk transfer issues from one repo to another.') { - argParser.addFlag( - 'apply-changes', - negatable: false, - help: 'WARNING: This will transfer the issues. Please preview the changes' - "first by running without '--apply-changes'.", - defaultsTo: false, - ); - argParser.addMultiOption( - 'issues', - valueHelp: '1,2,3', - help: 'Specifiy the numbers of specific issues to transfer, otherwise' - ' transfers all.', - ); - argParser.addOption( - 'source-repo', - valueHelp: 'repo-org/repo-name', - help: 'The source repository for the issues to be moved from.', - mandatory: true, - ); - argParser.addOption( - 'target-repo', - valueHelp: 'repo-org/repo-name', - help: 'The target repository name where the issues will be moved to.', - mandatory: true, - ); - argParser.addOption( - 'add-label', - help: 'Add a label to all transferred issues.', - valueHelp: 'package:foo', - ); + argParser + ..addFlag( + 'apply-changes', + negatable: false, + help: + 'WARNING: This will transfer the issues. Please preview the changes' + "first by running without '--apply-changes'.", + defaultsTo: false, + ) + ..addOption( + 'source-repo', + valueHelp: 'repo-org/repo-name', + help: 'The source repository for the issues to be moved from.', + mandatory: true, + ) + ..addOption( + 'target-repo', + valueHelp: 'repo-org/repo-name', + help: 'The target repository name where the issues will be moved to.', + mandatory: true, + ) + ..addOption( + 'add-label', + help: 'Add a label to all transferred issues.', + valueHelp: 'package:foo', + ); } @override @@ -52,13 +48,12 @@ class TransferIssuesCommand extends ReportCommand { @override Future run() async { - var applyChanges = argResults!['apply-changes'] as bool; + var parsedArgs = argResults!; + var applyChanges = parsedArgs.flag('apply-changes'); - var sourceRepo = argResults!['source-repo'] as String; - var targetRepo = argResults!['target-repo'] as String; + var sourceRepo = parsedArgs.option('source-repo')!; + var targetRepo = parsedArgs.option('target-repo')!; - var issueNumberString = argResults!['issues'] as List?; - var issueNumbers = issueNumberString?.map(int.parse).toList(); var labelName = argResults!['add-label'] as String?; if (!applyChanges) { @@ -68,7 +63,6 @@ class TransferIssuesCommand extends ReportCommand { return await transferAndLabelIssues( RepositorySlug.full(sourceRepo), RepositorySlug.full(targetRepo), - issueNumbers, labelName, applyChanges, ); @@ -77,7 +71,6 @@ class TransferIssuesCommand extends ReportCommand { Future transferAndLabelIssues( RepositorySlug sourceRepo, RepositorySlug targetRepo, [ - List? issueNumbers, String? labelName, bool applyChanges = false, ]) async { @@ -118,10 +111,7 @@ class TransferIssuesCommand extends ReportCommand { return 0; } - Future> getIssueIds( - RepositorySlug slug, [ - List? issueNumbers, - ]) async { + Future> getIssueIds(RepositorySlug slug) async { final queryString = '''query { repository(owner:"${slug.owner}", name:"${slug.name}") { issues(last:100) { @@ -144,9 +134,6 @@ class TransferIssuesCommand extends ReportCommand { var nodes = issues['nodes'] as List; return nodes .map((node) => node as Map) - .where((node) => issueNumbers != null - ? issueNumbers.contains(node['number'] as int) - : true) .map((node) => node['id'] as String) .toList(); },