Skip to content

Instantly share code, notes, and snippets.

@invisiblek
Last active March 30, 2018 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save invisiblek/ac890b6c383b48d41dd9c15027b6251d to your computer and use it in GitHub Desktop.
Save invisiblek/ac890b6c383b48d41dd9c15027b6251d to your computer and use it in GitHub Desktop.
#!/bin/bash
export oldtag=android-7.1.1_r6
export newtag=LA.UM.5.5.r1-02200-8x96.0
export cmversion=14.1
# CAF
export remotebase=https://source.codeaurora.org/quic/la/platform
# AOSP
#export remotebase=https://android.googlesource.com/platform
cd android
repo sync -j16 -q -d --force-sync .
cd -
export currenttag=`sed -e '1,/name="aosp"/d' android/default.xml | tail -n +3 | head -1 | sed 's| revision="refs/tags/||g' | sed 's|" />||g'`
if [[ $currenttag == $newtag ]]; then
echo "It appears you're already at $newtag"
echo "Have you updated the variables in this script?"
echo "Exiting..."
exit 1
fi
if [[ $currenttag != $oldtag ]]; then
echo "You're not sitting at $oldtag, you're at $currenttag"
echo "Have you updated the variables in this script?"
echo "Exiting..."
exit 1
fi
rm -rf ~/merged_repos
rm -rf ~/upstream_updated_repos
repo forall -j16 -c '
echo $REPO_PROJECT
repo sync -j16 -q -d . 2> /dev/null
git for-each-ref --format "%(refname:short)" refs/heads | grep -v master | xargs git branch -D 2> /dev/null
if [[ $REPO_REMOTE == "github" ]]; then
git remote rm upstream 2> /dev/null
p=$(echo $REPO_PROJECT | sed 's#LineageOS\/android_##g' | sed 's#LineageOS\/##g' | sed 's#_#/#g')
# we can safely ignore device,kernel and vendor repos. along with anything *-caf
if [[ ! $p == device* ]] && [[ ! $p == kernel* ]] && [[ ! $p == vendor* ]] && [[ ! $p == hudson ]] && [[ ! $REPO_PATH == *-caf* ]] && [[ ! $REPO_PATH == *cmsdk* ]] && [[ ! $REPO_PATH == *cyanogen* ]]; then
remote=$remotebase/$p
git remote add upstream $remote 2> /dev/null
response=`curl -o /dev/null --silent --head --write-out '%{http_code}' $remote`
if [[ $response == 200 ]]; then
git fetch upstream 2> /dev/null
if (git tag | grep -q $newtag); then
git reset 2> /dev/null
git checkout . 2> /dev/null
git clean -df 2> /dev/null
git branch -D $newtag 2> /dev/null
repo sync -j16 -q -d --force-sync . 2> /dev/null
repo start $cmversion . 2> /dev/null
result=`git merge --no-edit $newtag 2>&1`
if [[ $result != "Already up-to-date." ]]; then
if [[ $result != *"Cannot merge"* ]]; then
echo "$REPO_PATH" >> ~/merged_repos
else
echo "--!-- $REPO_PATH" >> ~/merged_repos
fi
fi
fi
fi
fi
elif [[ $REPO_REMOTE == "aosp" ]]; then
if [[ `git diff $oldtag $newtag` != "" ]]; then
echo $REPO_PATH >> ~/upstream_updated_repos
fi
fi
'
echo -e "================================================================================================="
echo -e ""
echo -e "\e[31mDon't forget to update the manifest!! This is left to do manually!\e[0m"
echo -e ""
echo -e "List of merged cm remotes at: \e[31m~/merged_repos\e[0m (those marked with --!-- will need to be looked at)"
echo -e "List of upstream-tracked repos that have changes at: \e[31m~/upstream_updated_repos\e[0m"
echo -e ""
echo -e "Tip after uploading manifest to init that particular manifest:"
echo -e " repo init -u https://review.lineageos.org/LineageOS/android -b refs/changes/95/176795/1"
echo -e ""
echo -e "================================================================================================="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment