diff options
| author | Carlos Maiolino <[email protected]> | 2026-05-02 14:09:27 +0200 |
|---|---|---|
| committer | Carlos Maiolino <[email protected]> | 2026-05-02 14:09:27 +0200 |
| commit | 296c6b9ee85209c0ce375717e30686545baea107 (patch) | |
| tree | f0da71650e8f58ca528589ad4e39476732fa5b88 /maintainer_old/pr-create.sh | |
| parent | b2e1a1cb259e482720430ff9898d2e564ee73d0f (diff) | |
Diffstat (limited to 'maintainer_old/pr-create.sh')
| -rwxr-xr-x | maintainer_old/pr-create.sh | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/maintainer_old/pr-create.sh b/maintainer_old/pr-create.sh new file mode 100755 index 0000000..948c441 --- /dev/null +++ b/maintainer_old/pr-create.sh @@ -0,0 +1,106 @@ +#!/bin/bash + +# pr-create: +# +# Create a Pull Request and send it to Linus Torvalds +# +# This script does: +# +# - Create a signed tag +# - push the branch and the tag to xfs-linux repository +# - Generate a list of patches in short-form +# - Craft a PR and email to Linus. +# + +REMOTE="xfs-linux" +BRANCH="$1" +TGT_BRANCH="linus/master" +TAG="$2" +TAG_MESSAGE="Signed-off-by: Carlos Maiolino <[email protected]>" +RECIPIENT="[email protected]" + +# Sending email global vars +usage() { + echo "usage: pr-create <branch> <tag>" +} + +die() { + echo "${1}... Exiting" + exit 1 +} + +git_verify_branch() { + local CUR_BRANCH=`git branch --show-current` + + if [ "${CUR_BRANCH}" != "${BRANCH}" ]; then + echo "Different branch is checked out..." + echo "... Attempting to checkout branch ${BRANCH}" + + git checkout -q ${BRANCH} 2> /dev/null + + if [ $? -ne 0 ]; then + return 1 + else + # Reset status to the old branch + git checkout -q ${CUR_BRANCH} 2> /dev/null + fi + fi +} + +git_create_tag() { + git tag -s ${TAG} -m "${TAG_MESSAGE}" +} + +push_branch() { + git push ${REMOTE} ${BRANCH}:${BRANCH} +} + +push_tag() { + git push ${REMOTE} ${TAG} +} + +git_craft_pr() { + local MSG=`git request-pull ${TGT_BRANCH} ${REMOTE} ${TAG}` + echo -e "$MSG" +} + +craft_message() { + + local MSG=$(git_craft_pr) + cat << ENDL +Hello Linus, + +Could you please pull patches included in the tag below? + +An attempt merge against your current TOT has been successful. + +Thanks, +Carlos + +${MSG} + +ENDL + +} + +generate_email() { + local MUTT_CONFIG="$HOME/.mutt/muttrc-Kernel" + neomutt -F ${MUTT_CONFIG} -s "$1" -i "$2" ${RECIPIENT} +} + +if [ -z "${BRANCH}" ] || [ -z "${TAG}" ]; then + usage +fi + +git_verify_branch + +if [ $? -ne 0 ]; then + die "Couldn't verify branch" +fi + +MAIL_MSG=$(mktemp) + +craft_message > $MAIL_MSG + +SUBJ="[GIT PULL] XFS: New code for for v6.18" +generate_email "$SUBJ" $MAIL_MSG |
