44 lines
1.3 KiB
Plaintext
44 lines
1.3 KiB
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
. build/envsetup.sh
|
||
|
|
||
|
PLATFORM="${1}"
|
||
|
SQUASH="${2}"
|
||
|
|
||
|
TOP="${ANDROID_BUILD_TOP}"
|
||
|
MANIFEST="${TOP}/.repo/manifest.xml"
|
||
|
BRANCH=$(grep "default revision" "${MANIFEST}" \
|
||
|
| sed 's/^ *//g;s/<default revision=\"refs\/heads\///g;s/\"//g')
|
||
|
STAGINGBRANCH="${BRANCH}-${PLATFORM}-gsi"
|
||
|
|
||
|
# Build list of LineageOS forked repos
|
||
|
PROJECTBLACKLIST="Gallery2"
|
||
|
PROJECTPATHS=$(grep "name=\"LineageOS/" "${MANIFEST}" \
|
||
|
| grep -v "clone-depth=\"1\"" \
|
||
|
| egrep -v ${PROJECTBLACKLIST} \
|
||
|
| sed -n 's/.*path="\([^"]\+\)".*/\1/p')
|
||
|
|
||
|
repo abandon "${STAGINGBRANCH}"
|
||
|
|
||
|
# Iterate over each forked project
|
||
|
for PROJECTPATH in ${PROJECTPATHS}; do
|
||
|
cd "${TOP}/${PROJECTPATH}"
|
||
|
repo start "${STAGINGBRANCH}" .
|
||
|
aospremote | grep -v "Remote 'aosp' created"
|
||
|
git fetch -q aosp "${PLATFORM}"-gsi
|
||
|
|
||
|
echo "#### Merging ${PLATFORM} into ${PROJECTPATH} ####"
|
||
|
if [ ! -z $SQUASH ]; then
|
||
|
git merge --log --squash aosp/"${PLATFORM}"-gsi
|
||
|
if [ $? -eq 1 ]; then read; fi
|
||
|
if ! git diff --cached --exit-code > /dev/null; then
|
||
|
git commit --no-edit
|
||
|
OLD_MSG=$(git log --format=%B -n1)
|
||
|
git commit --amend -m "[DNM] Squash of ${STAGINGBRANCH}" -m "$OLD_MSG"
|
||
|
fi
|
||
|
else
|
||
|
git merge --log aosp/"${PLATFORM}"-gsi
|
||
|
if [ $? -eq 1 ]; then read; fi
|
||
|
fi
|
||
|
done
|