git: 6fb2339611cd - main - ghpr: Only label the branch as merged
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 21 Apr 2025 21:55:33 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=6fb2339611cd19271fd5ae1034f5dddad36c59dc commit 6fb2339611cd19271fd5ae1034f5dddad36c59dc Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2025-04-21 21:52:49 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2025-04-21 21:55:00 +0000 ghpr: Only label the branch as merged Stop trying to push to the pull request branches. Only I have permission to do that. Add 'meged' tag. This isn't quite as good as having the PRs show up as 'merged' since there's some stats based on that which won't happen. However, it's too much of a hassle, so just stop doing it. We now require the 'gh' but don't make sure that it's around. Note: We still need better error handling, for this and other things. Sponsored by: Netflix --- tools/tools/git/ghpr/ghpr-push.sh | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/tools/tools/git/ghpr/ghpr-push.sh b/tools/tools/git/ghpr/ghpr-push.sh index 21cd9b52e41b..587a0bb8ff27 100644 --- a/tools/tools/git/ghpr/ghpr-push.sh +++ b/tools/tools/git/ghpr/ghpr-push.sh @@ -8,24 +8,35 @@ die() { } staging=staging +do_pr_branch_push=false + # Iteratively try to push all the branches, then push upstream. Repeat until the upstream # push works... while true; do - for pr in $(git config --get-all branch.${staging}.opabinia.prs); do - upstream=$(git config --get branch.${staging}.opabinia.${pr}.upstream) - upstream_branch=$(git config --get branch.${staging}.opabinia.${pr}.upstream-branch) - - git push $upstream HEAD:$upstream_branch --force || true # bare git push gives cut and paste line - done + # We'll likely drop pushing to the pull request branches, but that's not + # final, so keep the code, but if false'd out. We'll make it a proper option + # or remove it once the discussion settles down. Only Warner can use it at + # the moment anyway. + if $do_pr_branch_push; then + for pr in $(git config --get-all branch.${staging}.opabinia.prs); do + upstream=$(git config --get branch.${staging}.opabinia.${pr}.upstream) + upstream_branch=$(git config --get branch.${staging}.opabinia.${pr}.upstream-branch) + git push $upstream HEAD:$upstream_branch --force || true # bare git push gives cut and paste line + done + fi if ! git push --push-option=confirm-author freebsd HEAD:main; then git fetch freebsd - git rebase freebsd/main ${stagig} + git rebase freebsd/main ${staging} continue fi break done +else + +fi + # OK, pull and rebase to catchup to these changes... git checkout main; @@ -33,7 +44,11 @@ git pull --rebase # try to cleanup for pr in $(git config --get-all branch.${staging}.opabinia.prs); do + if ! $do_pr_branch_push; then + gh pr edit $pr --edit --add-label merged + fi git branch -D PR-${pr} git config --remove-section branch.${staging}.opabinia.${pr} done git config --remove-section branch.${staging}.opabinia +git branch -D ${staging}