From 6636a78044f9c6420f3505b0e8b58e9cc9a83333 Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm Date: Sun, 14 Jul 2024 19:36:31 +0200 Subject: [PATCH] GH-704 - Improve back-port script to cherry pick all commits associated to the source ticket. --- etc/create-backport-tickets.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/etc/create-backport-tickets.sh b/etc/create-backport-tickets.sh index 2050c9c4..64c5ca20 100755 --- a/etc/create-backport-tickets.sh +++ b/etc/create-backport-tickets.sh @@ -16,12 +16,19 @@ do # Turn 1.5.6 into 1.5.x targetBranch="$(echo "$version" | grep -oE '^[0-9]+\.[0-9]+').x" + # The SHAs of all commits associated with the source ticket + shas=$(git log --grep="$sourceGh" --reverse --format="%H") + # Checkout target branch and cherry-pick commit echo "Checking out branch $targetBranch" git checkout $targetBranch - echo "Cherry-pick commit from $branch" - git cherry-pick $branch + # Cherry-pick all previously found SHAs + while IFS= read -r sha + do + echo "Cherry-pick commit $sha from $branch" + git cherry-pick $sha + done <<< $shas echo "gh issue create --title \"$title\" --body \"Back-port of $sourceGh.\" --label \"$labels\" --assignee \"@me\" --milestone \"$version\"" number=$(gh issue create --title "$title" --body "Back-port of $sourceGh." --label "$labels" --assignee "@me" --milestone "$version" | awk -F '/' '{print $NF}')