Skip to content

Commit a12ef99

Browse files
Merge pull request #2234 from android:cherrypickscript
PiperOrigin-RevId: 647048543
2 parents cbceef9 + 071a189 commit a12ef99

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
# Script to cherry pick a commit to a 'in progress' release branch
4+
#
5+
#
6+
# Usage:
7+
# export RELEASE_BRANCH=axt_XXX_release_branch # if not already defined
8+
# bash tools/release/cherrypick_to_release_branch.sh commit_hash
9+
10+
set -e
11+
12+
if [[ -n $(git status -s) ]]; then
13+
echo "Error: git directory is not clean; check 'git status'"
14+
exit 1
15+
fi
16+
17+
if [ "$#" -ne 1 ]; then
18+
echo "Error: Unexpected number of parameters: Usage: cherrypick_to_release_branch.sh commit_hash"
19+
exit 1
20+
fi
21+
22+
if [[ ! "$RELEASE_BRANCH" =~ "release_branch" ]]; then
23+
echo "Error: RELEASE_BRANCH env var is undefined or does not contain 'release_branch'"
24+
exit 1
25+
fi
26+
27+
echo "Syncing main branch"
28+
git remote update
29+
git checkout main
30+
git pull
31+
32+
echo "Checking out ${RELEASE_BRANCH}_in_progress and syncing"
33+
git checkout ${RELEASE_BRANCH}_in_progress
34+
git pull
35+
36+
echo "Cherrypicking $1 and pushing upstream"
37+
git cherry-pick $1
38+
git push --set-upstream origin ${RELEASE_BRANCH}_in_progress
39+
40+
echo "Navigate to https://github.com/android/android-test/compare/${RELEASE_BRANCH}...${RELEASE_BRANCH}_in_progress to create a PR"
41+

0 commit comments

Comments
 (0)