git: d02883b3d8d0 - main - tools/git/ghpr: retire

From: Enji Cooper <ngie_at_FreeBSD.org>
Date: Tue, 10 Nov 2026 02:15:39 UTC
The branch main has been updated by ngie:

URL: https://cgit.FreeBSD.org/src/commit/?id=d02883b3d8d0943fdb98cbc365074263f918908b

commit d02883b3d8d0943fdb98cbc365074263f918908b
Author:     Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2026-11-10 02:15:13 +0000
Commit:     Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-11-10 02:15:13 +0000

    tools/git/ghpr: retire
    
    The project under the .../ghpr subdirectory is an earlier version of the
    tool. A newer/supported iteration of the tool can be found on
    [GitHub][ghpr-repo].
    
    `ghpr` can be installed via `pkg`, e.g., `pkg install py312-ghpr-5`.
    
    Please see the [README.md][readme] for further details.
    
    MFC after:      1 month
    
    [ghpr-repo]: https://github.com/bsdimp/ghpr/
    [readme]: https://github.com/bsdimp/ghpr/blob/main/README.md
    
    Reviewed by:    dteske
    Differential Revision:  https://reviews.freebsd.org/D61086
---
 tools/tools/git/ghpr/README        |  5 ---
 tools/tools/git/ghpr/ghpr-init.sh  | 29 ---------------
 tools/tools/git/ghpr/ghpr-push.sh  | 51 ---------------------------
 tools/tools/git/ghpr/ghpr-stage.sh | 72 --------------------------------------
 4 files changed, 157 deletions(-)

diff --git a/tools/tools/git/ghpr/README b/tools/tools/git/ghpr/README
deleted file mode 100644
index e07d56b1e09b..000000000000
--- a/tools/tools/git/ghpr/README
+++ /dev/null
@@ -1,5 +0,0 @@
-These are totally experimental
-
-Shared for collaboration on writing them, if you aren't
-in touch with Warner about them, you may find it's super
-tough sledding to use them.
diff --git a/tools/tools/git/ghpr/ghpr-init.sh b/tools/tools/git/ghpr/ghpr-init.sh
deleted file mode 100644
index 567148b14716..000000000000
--- a/tools/tools/git/ghpr/ghpr-init.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-
-set -e
-
-die() {
-    echo $*
-    exit 1
-}
-
-# Create a fresh branch for the staging tree.
-BRANCH=${1:-staging}
-base=main
-
-if [ "$(git config branch.${BRANCH}.opabinia)" = "true" ]; then
-    echo "Branch ${BRANCH} has already been initialized"
-    # Bail if the branch already exists
-else
-    if git rev-parse --verify ${BRANCH} > /dev/null 2>&1; then
-	echo "Branch ${BRANCH} already exists, skipping creation, but rebasing to ${base}"
-	git rebase ${base} ${BRANCH}
-    else
-	# Create the branch and tag it as the one we're using for opabinia merging.
-	echo "Creating ${BRANCH} from ${base} to land changes"
-	git checkout -b ${BRANCH} ${base} || die "Can't create ${BRANCH}"
-    fi
-fi
-
-git config set --type bool --all branch.${BRANCH}.opabinia true || die "Can't annotate"
-git config set --all branch.${BRANCH}.opabinia.base "${base}" || die "Can't annotate"
diff --git a/tools/tools/git/ghpr/ghpr-push.sh b/tools/tools/git/ghpr/ghpr-push.sh
deleted file mode 100644
index 1d11f31cc52a..000000000000
--- a/tools/tools/git/ghpr/ghpr-push.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/sh
-
-set -e
-
-die() {
-    echo $*
-    exit 1
-}
-
-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
-    # 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 ${staging}
-	  continue
-      fi
-      break
-done
-
-# OK, pull and rebase to catchup to these changes...
-git checkout main;
-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 --add-label merged
-	gh pr close $pr --comment "Automated message from ghpr: Thank you for your submission. This PR has been merged to FreeBSD's `main` branch. These changes will appear shortly on our GitHub mirror."
-    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}
diff --git a/tools/tools/git/ghpr/ghpr-stage.sh b/tools/tools/git/ghpr/ghpr-stage.sh
deleted file mode 100644
index df9eeeeea5a3..000000000000
--- a/tools/tools/git/ghpr/ghpr-stage.sh
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/sh
-
-set -e
-
-die() {
-    echo $*
-    exit 1
-}
-
-update_to_upstream() (
-    local staging=$1
-    local base=$2
-
-    git checkout ${base}
-    git pull --rebase
-    git rebase -i ${base} ${staging}
-)
-
-PR=$1
-staging=staging
-
-[ -n "${PR}" ] || die "Need a pr"
-
-if [ "$(git config branch.${staging}.opabinia)" != "true" ]; then
-    die "Branch ${staging} has not been initialized"
-fi
-
-base=$(git config branch.${staging}.opabinia.base)
-[ -n "${base}" ] || die "No base set on ${staging}"
-
-if [ -z "$(git config --get-all branch.${staging}.opabinia.prs)" ]; then
-    # Update ${base} if prs list is empty
-    update_to_upstream ${staging} ${base}
-else
-    # Otherwise checkout staging as is
-    git checkout ${staging}
-fi
-
-# OK. We always have to create a new branch for the PR. We do this into
-# ${base} first (since that's what gh pr checkout does). We then then rebase
-# this branch onto the staging branch, doing the rebase rewriting along the
-# way. This rather convoluted setup was selected over cherry-picking and/or
-# pulling a formatted patch to apply because it always applies it correctly
-# and then we use git's tools to merge, pushing the problems there rather than
-# trying to deal with them ourselves here.
-
-# In the future, PR may be a list
-# Also, error handling is annoying at best.
-
-git branch -D PR-$PR || true
-gh pr checkout $PR -b PR-$PR
-
-upstream=$(git config branch.PR-$PR.pushRemote)
-upstream_branch=$(git config branch.PR-$PR.merge | sed -e s=refs/heads/==)
-
-git rebase -i ${base} --onto ${staging} --exec 'env EDITOR=$HOME/bin/git-fixup-editor git commit --amend --trailer "Reviewed-by: imp" --trailer "Pull-Request: https://github.com/freebsd/freebsd-src/pull/'"$PR"'"'
-# Save the upstream data
-git config --add branch.${staging}.opabinia.prs ${PR}
-git config --add branch.${staging}.opabinia.${PR}.upstream ${upstream}
-git config --add branch.${staging}.opabinia.${PR}.upstream-branch ${upstream_branch}
-# Move the staging branch to the new tip of the tree.
-git checkout -B ${staging} HEAD
-
-# XXX need to somehow scrape the PR for approvals, translate that to FreeBSD's name
-# and add that in the Reviewed-by stuff... that's done by hand...
-
-# Sanity check things... not 100% right, since it checks everything we're queued up so far...
-tools/build/checkstyle9.pl ${base}..${staging}
-
-# Bump .Dd dates?
-# run before/after igor?
-# Anything else?