Skip to content

Commit

Permalink
Handle already queued PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
squidadm committed Jul 25, 2023
1 parent 5f0375a commit 992c7dc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions maintenance/code-backports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,21 @@ git checkout $beQuiet v$version-next-backports 2>/dev/null &&
git fetch $beQuiet --all &&
git pull $beQuiet origin v$version-next-backports &&
git rebase origin/v$version 2>/dev/null &&
git push -u origin v$version-next-backports|| abortAndExit rebase
git push -u origin +v$version-next-backports || abortAndExit rebase

# Find backports to attempt:
prlist=`gh pr list -L 1 --repo squid-cache/squid --state closed --label backport-to-v$version | wc -l`
if test "$prlist" -ne 0; then
gh pr list --repo squid-cache/squid --state closed --label backport-to-v$version | while read prnum text; do
# find a commit in $srcbranch with " (#$prnum)" subject suffix
git log --oneline github/$srcbranch --grep=" (#$prnum)\$" | while read sha rest; do
msg=`git cherry-pick $sha || abortAndContinue cherry-pick`
if ! test -z $msg ; then
msg=`git cherry-pick $beQuiet $sha 2>&1 || abortAndContinue cherry-pick`
if ! test -z "$msg" ; then
echo $msg | grep -E "^error:"
if `echo $msg | grep "The previous cherry-pick is now empty"`; then
gh pr edit $prnum --remove-label backport-to-v$version
gh pr comment $prnum --body "queued for backport to v$version"
fi
fi
gitCleanWorkspace
done
Expand Down

0 comments on commit 992c7dc

Please sign in to comment.