diff --git a/pkgs/repo_manage/lib/issue_transfer.dart b/pkgs/repo_manage/lib/issue_transfer.dart index d69cc3da..3bed0237 100644 --- a/pkgs/repo_manage/lib/issue_transfer.dart +++ b/pkgs/repo_manage/lib/issue_transfer.dart @@ -2,6 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. +import 'package:collection/collection.dart'; import 'package:github/github.dart'; import 'package:graphql/client.dart'; @@ -185,13 +186,18 @@ class TransferIssuesCommand extends ReportCommand { } print('Transfer ${issueIds.length} issues from $sourceRepo to $targetRepo' ' with id $repositoryId'); - var transferredIssues = await _transferMutation( - issueIds, - repositoryId, - applyChanges, - ); - allIssueIds.addAll(transferredIssues); + for (var issueIdChunk in issueIds.slices(10)) { + print('Transferring a chunk of ${issueIdChunk.length} issues'); + var transferredIssues = await _transferMutation( + issueIdChunk, + repositoryId, + applyChanges, + ); + allIssueIds.addAll(transferredIssues); + await Future.delayed(const Duration(seconds: 1)); + } + if (!applyChanges) { // Return mock list of indices to allow user to see how downstream // methods would continue. diff --git a/pkgs/trebuchet/README.md b/pkgs/trebuchet/README.md index 21f94013..f2941eaa 100644 --- a/pkgs/trebuchet/README.md +++ b/pkgs/trebuchet/README.md @@ -7,10 +7,12 @@ This is a tool to move existing packages into monorepos. ```bash dart run bin/trebuchet.dart \ --input-name coverage \ ---branch-name master \ +--branch-name master \ --input-path ~/projects/coverage/ \ +--target tools \ --target-path ~/projects/tools/ \ ---git-filter-repo ~/tools/git-filter-repo +--git-filter-repo ~/tools/git-filter-repo \ +--dry-run ``` This basically executes the instructions at https://github.com/dart-lang/ecosystem/wiki/Merging-existing-repos-into-a-monorepo \ No newline at end of file diff --git a/pkgs/trebuchet/bin/trebuchet.dart b/pkgs/trebuchet/bin/trebuchet.dart index 9286cc23..02bbfb7f 100644 --- a/pkgs/trebuchet/bin/trebuchet.dart +++ b/pkgs/trebuchet/bin/trebuchet.dart @@ -17,6 +17,10 @@ Future main(List arguments) async { 'input-path', help: 'Path to the package which should be transferred to a mono-repo', ) + ..addOption( + 'target', + help: 'Name of the mono-repo', + ) ..addOption( 'target-path', help: 'Path to the mono-repo', @@ -42,11 +46,12 @@ Future main(List arguments) async { negatable: false, ); - String? input; - String? inputPath; - String? targetPath; - String? branchName; - String? gitFilterRepo; + String input; + String inputPath; + String target; + String targetPath; + String branchName; + String gitFilterRepo; bool dryRun; try { final parsed = argParser.parse(arguments); @@ -57,6 +62,7 @@ Future main(List arguments) async { input = parsed.option('input-name')!; inputPath = parsed.option('input-path')!; + target = parsed.option('target')!; targetPath = parsed.option('target-path')!; branchName = parsed.option('branch-name')!; gitFilterRepo = parsed.option('git-filter-repo')!; @@ -71,6 +77,7 @@ Future main(List arguments) async { final trebuchet = Trebuchet( input: input, inputPath: inputPath, + target: target, targetPath: targetPath, branchName: branchName, gitFilterRepo: gitFilterRepo, @@ -83,6 +90,7 @@ Future main(List arguments) async { class Trebuchet { final String input; final String inputPath; + final String target; final String targetPath; final String branchName; final String gitFilterRepo; @@ -91,6 +99,7 @@ class Trebuchet { Trebuchet({ required this.input, required this.inputPath, + required this.target, required this.targetPath, required this.branchName, required this.gitFilterRepo, @@ -162,6 +171,7 @@ ${shouldPush ? '' : '- Run `git push --set-upstream origin merge-$input-package` - Disable squash-only in GitHub settings, and merge with a fast forward merge to the main branch, enable squash-only in GitHub settings. - 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` - Add a commit to https://github.com/dart-lang/$input/ with it's readme pointing to the monorepo. - Update the auto-publishing settings on pub.dev/packages/$input. - Archive https://github.com/dart-lang/$input/. @@ -178,11 +188,12 @@ ${shouldPush ? '' : '- Run `git push --set-upstream origin merge-$input-package` String executable, List arguments, { bool inTarget = true, + bool overrideDryRun = false, }) async { final workingDirectory = inTarget ? targetPath : inputPath; print('----------'); print('Running `$executable $arguments` in $workingDirectory'); - if (!dryRun) { + if (!dryRun || overrideDryRun) { final processResult = await Process.run( executable, arguments,