Skip to content

Commit bc7a6d7

Browse files
committed
build: force upstream fetch before merge (#21192)
PR Close #21192
1 parent 9f538a6 commit bc7a6d7

2 files changed

Lines changed: 7 additions & 22 deletions

File tree

docs/CARETAKER.md

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,11 @@ Caretaker is responsible for merging PRs into the individual branches and intern
77
- Draining the queue of PRs ready to be merged. (PRs with [`PR action: merge`](https://github.com/angular/angular/pulls?q=is%3Aopen+is%3Apr+label%3A%22PR+action%3A+merge%22) label)
88
- Assigining [new issues](https://github.com/angular/angular/issues?q=is%3Aopen+is%3Aissue+no%3Alabel) to individual component authors.
99

10-
## Setup
11-
12-
### Set `upstream` to fetch PRs into your local repo
13-
14-
Use this conmmands to configure your `git` to fetch PRs into your local repo.
15-
16-
```
17-
git remote add upstream [email protected]:angular/angular.git
18-
git config --add remote.upstream.fetch +refs/pull/*/head:refs/remotes/upstream/pr/*
19-
```
20-
21-
2210
## Merging the PR
2311

2412
A PR needs to have `PR action: merge` and `PR target: *` labels to be considered
2513
ready to merge. Merging is performed by running `merge-pr` with a PR number to merge.
2614

27-
NOTE: before running `merge-pr` ensure that you have synced all of the PRs
28-
locally by running:
29-
30-
```
31-
$ git fetch upstream
32-
```
33-
3415
To merge a PR run:
3516

3617
```
@@ -40,6 +21,7 @@ $ ./scripts/github/merge-pr 1234
4021
The `merge-pr` script will:
4122
- Ensure that all approriate labels are on the PR.
4223
- That the current branch (`master` or `?.?.x` patch) mathches the `PR target: *` label.
24+
- Fetches the latest PR code from the `angular/angular` repo.
4325
- It will `cherry-pick` all of the SHAs from the PR into the current branch.
4426
- It will rewrite commit history by automatically adding `Close #1234` and `(#1234)` into the commit message.
4527

@@ -53,8 +35,8 @@ $ ./scripts/github/merge-pr 1234
5335
======================
5436
GitHub Merge PR Steps
5537
======================
56-
git cherry-pick upstream/pr/1234~1..upstream/pr/1234
57-
git filter-branch -f --msg-filter "/usr/local/google/home/misko/angular-pr/scripts/github/utils/github.closes 1234" HEAD~1..HEAD
38+
git cherry-pick angular/pr/1234~1..angular/pr/1234
39+
git filter-branch -f --msg-filter "/home/misko/angular/scripts/github/utils/github.closes 1234" HEAD~1..HEAD
5840
```
5941

6042
If the `cherry-pick` command fails than resolve conflicts and use `git cherry-pick --continue` once ready. After the `cherry-pick` is done cut&paste and run the `filter-branch` command to properly rewrite the messages

scripts/github/merge-pr

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,20 @@ else
6767
fi
6868

6969

70-
CHERRY_PICK_PR="git cherry-pick upstream/pr/$PR_NUMBER~$PR_SHA_COUNT..upstream/pr/$PR_NUMBER"
70+
FETCH_PR="git fetch https://github.com/angular/angular.git pull/$PR_NUMBER/head:angular/pr/$PR_NUMBER"
71+
CHERRY_PICK_PR="git cherry-pick angular/pr/$PR_NUMBER~$PR_SHA_COUNT..angular/pr/$PR_NUMBER"
7172
REWRITE_MESSAGE="git filter-branch -f --msg-filter \"$BASEDIR/utils/github_closes.js $PR_NUMBER\" HEAD~$PR_SHA_COUNT..HEAD"
7273

7374
echo "======================"
7475
echo "GitHub Merge PR Steps"
7576
echo "======================"
77+
echo " $FETCH_PR"
7678
echo " $CHERRY_PICK_PR"
7779
echo " $REWRITE_MESSAGE"
7880
echo "----------------------"
7981

8082
echo ">>> Cherry Pick: $CHERRY_PICK_PR"
83+
$FETCH_PR
8184
$CHERRY_PICK_PR
8285

8386
echo

0 commit comments

Comments
 (0)