diff options
| author | Natalia <124304+nessita@users.noreply.github.com> | 2025-11-20 12:31:59 -0300 |
|---|---|---|
| committer | Natalia <124304+nessita@users.noreply.github.com> | 2025-11-21 15:38:20 -0300 |
| commit | 2f0947146f48e9cacf671d5e6b3860f1caa5538a (patch) | |
| tree | 840084da21940b99efb55abe070613819f331498 /scripts/backport.sh | |
| parent | 53c9de624e21fba2606f1b4f33690504fdc39c41 (diff) | |
[5.2.x] Added scripts for building and releasing Django artifacts.
Backport of a523d5c8336f5f7f5e24a1cc8034ce65aedec3c6 from main.
Diffstat (limited to 'scripts/backport.sh')
| -rwxr-xr-x | scripts/backport.sh | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/scripts/backport.sh b/scripts/backport.sh new file mode 100755 index 0000000000..6c98697564 --- /dev/null +++ b/scripts/backport.sh @@ -0,0 +1,35 @@ +#!/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 |
