Ben Clayton | d42d2fd | 2020-02-13 18:36:28 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # update-marl merges the latest changes from the github.com/google/marl into |
| 4 | # third_party/marl. This script copies the change descriptions from the squash |
| 5 | # change into the top merge change, along with a standardized description. |
| 6 | REASON=$1 |
| 7 | |
| 8 | if [ ! -z "$REASON" ]; then |
| 9 | REASON="\n$REASON\n" |
| 10 | fi |
| 11 | |
Ben Clayton | af80f85 | 2020-06-15 15:31:58 +0100 | [diff] [blame] | 12 | git subtree pull --prefix third_party/marl https://github.com/google/marl main --squash -m "Update marl" |
Ben Clayton | d42d2fd | 2020-02-13 18:36:28 +0000 | [diff] [blame] | 13 | |
| 14 | ALL_CHANGES=`git log -n 1 HEAD^2 | egrep '^(\s{4}[0-9a-f]{9}\s*.*)$'` |
| 15 | HEAD_CHANGE=`echo "$ALL_CHANGES" | egrep '[0-9a-f]{9}' -o -m 1` |
Ben Clayton | d0de9dc | 2021-12-24 13:48:28 +0000 | [diff] [blame] | 16 | LOG_MSG=`echo -e "Update Marl to $HEAD_CHANGE\n${REASON}\nChanges:\n$ALL_CHANGES\n\nCommands:\n ./third_party/update-marl.sh\n\nBug: b/140546382"` |
Ben Clayton | 02e15b2 | 2020-03-26 20:19:56 +0000 | [diff] [blame] | 17 | git commit --amend -m "$LOG_MSG" |
Alexis Hetu | 26c5afe | 2022-08-16 17:39:53 -0400 | [diff] [blame] | 18 | |
| 19 | # Use filter-branch to apply the Gerrit commit hook to both CLs |
| 20 | GIT_DIR=$(readlink -f "$(git rev-parse --git-dir)") |
| 21 | TMP_MSG="${GIT_DIR}/COMMIT_MSG_REWRITE" |
| 22 | FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch -f --msg-filter \ |
| 23 | "cat > ${TMP_MSG} && \"${GIT_DIR}/hooks/commit-msg\" ${TMP_MSG} && cat \"${TMP_MSG}\"" HEAD...HEAD~1 |
| 24 | rm -rf "${TMP_MSG}" |