mirror of
https://github.com/django/django.git
synced 2026-02-09 02:49:25 +08:00
36 lines
655 B
Bash
Executable File
36 lines
655 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Backport helper for Django stable branches.
|
|
|
|
set -xue
|
|
|
|
if [ -z $1 ]; then
|
|
echo "Full hash of commit to backport is required."
|
|
exit
|
|
fi
|
|
|
|
BRANCH_NAME=`git branch | sed -n '/\* stable\//s///p'`
|
|
echo $BRANCH_NAME
|
|
|
|
# Ensure clean working directory
|
|
git reset --hard
|
|
|
|
REV=$1
|
|
|
|
TMPFILE=tmplog.tmp
|
|
|
|
# Cherry-pick the commit
|
|
git cherry-pick ${REV}
|
|
|
|
# Create new log message by modifying the old one
|
|
git log --pretty=format:"[${BRANCH_NAME}] %s%n%n%b%nBackport of ${REV} from main." HEAD^..HEAD \
|
|
| grep -v '^BP$' > ${TMPFILE}
|
|
|
|
# Commit new log message
|
|
git commit --amend -F ${TMPFILE}
|
|
|
|
# Clean up temporary files
|
|
rm -f ${TMPFILE}
|
|
|
|
git show
|