Skip to content

Commit 758291c

Browse files
authored
GODRIVER-3300 Clean up cherry-picker script (#1744)
1 parent e583aa6 commit 758291c

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

docs/CONTRIBUTING.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ If a Pull Request needs to be cherry-picked to a new branch, get the sha of the
6161
bash etc/cherry-picker.sh <sha>
6262
```
6363

64-
The cherry-picker script is configured to use `v1` as the base branch and `master` as the target branch.
64+
By default it will use `master` as the target branch. The branch can be specified as the second argument, e.g.
65+
66+
```bash
67+
bash etc/cherry-picker.sh <sha> branch
68+
```
69+
6570
It will create a new checkout in a temp dir, create a new branch, perform the cherry-pick, and then
6671
prompt before creating a PR to the target branch.
6772

etc/cherry-picker.sh

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
set -e
33

44
sha=$1
5-
base=v1
6-
target=master
5+
target=${2:-master}
76
dirname=$(mktemp -d)
87
user=$(git config github.user)
98

@@ -32,8 +31,7 @@ fi
3231
gh repo set-default mongodb/mongo-go-driver
3332
branch="cherry-pick-$sha"
3433
head="$user:$branch"
35-
git fetch origin $base
36-
git fetch origin $target
34+
git fetch origin
3735
git checkout -b $branch origin/$target
3836
git cherry-pick -x $sha || true
3937

@@ -56,7 +54,7 @@ text=$(echo $old_title | sed -r 's/([A-Z]+-[0-9]+) (.*) \(#[0-9]*\)/\2/')
5654
pr_number=$(echo $old_title| sed -r 's/.*(#[0-9]*)\)/\1/')
5755

5856
title="$ticket [$target] $text"
59-
body="Cherry-pick of $pr_number from $base to $target"
57+
body="Cherry-pick of $pr_number to $target"
6058

6159
echo
6260
echo "Creating PR..."

0 commit comments

Comments
 (0)