blob: 09aa245272ea80b34d1dc7c3ca3ab5cac536493b [file] [log] [blame]
Ben Claytond42d2fd2020-02-13 18:36:28 +00001#!/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.
6REASON=$1
7
8if [ ! -z "$REASON" ]; then
9 REASON="\n$REASON\n"
10fi
11
Ben Claytonaf80f852020-06-15 15:31:58 +010012git subtree pull --prefix third_party/marl https://github.com/google/marl main --squash -m "Update marl"
Ben Claytond42d2fd2020-02-13 18:36:28 +000013
14ALL_CHANGES=`git log -n 1 HEAD^2 | egrep '^(\s{4}[0-9a-f]{9}\s*.*)$'`
15HEAD_CHANGE=`echo "$ALL_CHANGES" | egrep '[0-9a-f]{9}' -o -m 1`
Ben Claytond0de9dc2021-12-24 13:48:28 +000016LOG_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 Clayton02e15b22020-03-26 20:19:56 +000017git commit --amend -m "$LOG_MSG"
Alexis Hetu26c5afe2022-08-16 17:39:53 -040018
19# Use filter-branch to apply the Gerrit commit hook to both CLs
20GIT_DIR=$(readlink -f "$(git rev-parse --git-dir)")
21TMP_MSG="${GIT_DIR}/COMMIT_MSG_REWRITE"
22FILTER_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
24rm -rf "${TMP_MSG}"