Skip to content

GODRIVER-3300 Clean up cherry-picker script #1744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ If a Pull Request needs to be cherry-picked to a new branch, get the sha of the
bash etc/cherry-picker.sh <sha>
```

The cherry-picker script is configured to use `v1` as the base branch and `master` as the target branch.
By default it will use `master` as the target branch. The branch can be specified as the second argument, e.g.

```bash
bash etc/cherry-picker.sh <sha> branch
```

It will create a new checkout in a temp dir, create a new branch, perform the cherry-pick, and then
prompt before creating a PR to the target branch.

Expand Down
8 changes: 3 additions & 5 deletions etc/cherry-picker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
set -e

sha=$1
base=v1
target=master
target=${2:-master}
dirname=$(mktemp -d)
user=$(git config github.user)

Expand Down Expand Up @@ -32,8 +31,7 @@ fi
gh repo set-default mongodb/mongo-go-driver
branch="cherry-pick-$sha"
head="$user:$branch"
git fetch origin $base
git fetch origin $target
git fetch origin
git checkout -b $branch origin/$target
git cherry-pick -x $sha || true

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

title="$ticket [$target] $text"
body="Cherry-pick of $pr_number from $base to $target"
body="Cherry-pick of $pr_number to $target"

echo
echo "Creating PR..."
Expand Down
Loading