1*03ce13f7SAndroid Build Coastguard Worker#!/bin/bash 2*03ce13f7SAndroid Build Coastguard Worker 3*03ce13f7SAndroid Build Coastguard Worker# update-marl merges the latest changes from the github.com/google/marl into 4*03ce13f7SAndroid Build Coastguard Worker# third_party/marl. This script copies the change descriptions from the squash 5*03ce13f7SAndroid Build Coastguard Worker# change into the top merge change, along with a standardized description. It 6*03ce13f7SAndroid Build Coastguard Worker# should be run from the top of the swiftshader directory, followed by 7*03ce13f7SAndroid Build Coastguard Worker# `git cl upload`. 8*03ce13f7SAndroid Build Coastguard Worker# 9*03ce13f7SAndroid Build Coastguard Worker# IMPORTANT NOTE: that git subtree doesn't play nicely with gerrit, so this script will 10*03ce13f7SAndroid Build Coastguard Worker# result in two separate CLs, the first of which will have a merge conflict. 11*03ce13f7SAndroid Build Coastguard Worker# You should force-submit the second (child) CL, ignoring the merge conflict on 12*03ce13f7SAndroid Build Coastguard Worker# the parent. Make sure you're up-to-date beforehand, to avoid the possibility 13*03ce13f7SAndroid Build Coastguard Worker# of a real merge conflict! 14*03ce13f7SAndroid Build Coastguard WorkerREASON=$1 15*03ce13f7SAndroid Build Coastguard Worker 16*03ce13f7SAndroid Build Coastguard Workerif [ ! -z "$REASON" ]; then 17*03ce13f7SAndroid Build Coastguard Worker REASON="\n$REASON\n" 18*03ce13f7SAndroid Build Coastguard Workerfi 19*03ce13f7SAndroid Build Coastguard Worker 20*03ce13f7SAndroid Build Coastguard Workergit subtree pull --prefix third_party/marl https://github.com/google/marl main --squash -m "Update marl" 21*03ce13f7SAndroid Build Coastguard Worker 22*03ce13f7SAndroid Build Coastguard WorkerALL_CHANGES=`git log -n 1 HEAD^2 | egrep '^(\s{4}[0-9a-f]{9}\s*.*)$'` 23*03ce13f7SAndroid Build Coastguard WorkerHEAD_CHANGE=`echo "$ALL_CHANGES" | egrep '[0-9a-f]{9}' -o -m 1` 24*03ce13f7SAndroid Build Coastguard WorkerLOG_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"` 25*03ce13f7SAndroid Build Coastguard Workergit commit --amend -m "$LOG_MSG" 26*03ce13f7SAndroid Build Coastguard Worker 27*03ce13f7SAndroid Build Coastguard Worker# Use filter-branch to apply the Gerrit commit hook to both CLs 28*03ce13f7SAndroid Build Coastguard WorkerGIT_DIR=$(readlink -f "$(git rev-parse --git-dir)") 29*03ce13f7SAndroid Build Coastguard WorkerTMP_MSG="${GIT_DIR}/COMMIT_MSG_REWRITE" 30*03ce13f7SAndroid Build Coastguard WorkerFILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch -f --msg-filter \ 31*03ce13f7SAndroid Build Coastguard Worker "cat > ${TMP_MSG} && \"${GIT_DIR}/hooks/commit-msg\" ${TMP_MSG} && cat \"${TMP_MSG}\"" HEAD...HEAD~1 32*03ce13f7SAndroid Build Coastguard Workerrm -rf "${TMP_MSG}"