Created
November 22, 2017 22:53
-
-
Save robstryker/cbf087cb100134551d0a95a8dcac8684 to your computer and use it in GitHub Desktop.
merge_missing_infopop.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -xe | |
# see also https://gist.github.com/nickboldt/6afc71826e82518c5e7b7d3c3fdcc4f3 | |
# merge sse repos into a single repo | |
START_TIME=`date +%s` | |
# work in a tempdir. The tmp-dir name is something like /home/user/tmp/this_scripts_name/ | |
tmpdir=~/tmp/${0/.sh/.tmp} | |
tmpdirCache=~/tmp/${0/.sh/.tmp}_cache | |
#rm -fr ${tmpdir} | |
mkdir -p ${tmpdir} | |
cd ${tmpdir} | |
# in case we have another alias for mv, like 'mv -i' | |
alias mv=mv | |
alias rm=rm | |
# set our local pull command depending on git version | |
verlte() { | |
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ] | |
} | |
verlt() { | |
[ "$1" = "$2" ] && return 1 || verlte $1 $2 | |
} | |
GIT_VERSION=`git version | head -1 | cut -f 3 -d " "` | |
verlte $GIT_VERSION 2.9.0 && ALLOW_PULL_FLAG=false || ALLOW_PULL_FLAG=true | |
if $ALLOW_PULL_FLAG | |
then | |
LOCAL_PULL_CMD="git pull --no-edit --allow-unrelated-histories --no-rebase --rebase=false" | |
else | |
LOCAL_PULL_CMD="git pull --no-edit --no-rebase --rebase=false" | |
fi | |
# Make sure different users with different settings will run the script as intended | |
gitBranchSettings () | |
{ | |
git config branch.autosetuprebase never | |
git config branch.autosetupmerge false | |
git config branch.master.rebase false | |
} | |
git clone http://git.eclipse.org/gitroot/jeetools/webtools.javaee.git | |
git clone http://git.eclipse.org/gitroot/sourceediting/webtools.sourceediting.git | |
# Make sure all branches are at master and have proper git settings | |
for d in webtools.sourceediting webtools.javaee; do | |
pushd ${d} | |
gitBranchSettings | |
git reset --hard origin/master | |
popd | |
done | |
cd webtools.javaee | |
git filter-branch --index-filter 'git rm --cached -qr --ignore-unmatch -- . && git reset -q $GIT_COMMIT -- docs/org.eclipse.wst.web.ui.infopop docs/org.eclipse.wst.web.ui.infopop' --prune-empty -- --all | |
cd ../ | |
cd webtools.sourceediting | |
$LOCAL_PULL_CMD ../webtools.javaee | |
git mv docs/org.eclipse.wst.web.ui.infopop web/docs/org.eclipse.wst.web.ui.infopop | |
rm -rf docs | |
cd web/docs/ | |
cat pom.xml | head -n 32 > pom2.xml | |
echo " <module>org.eclipse.wst.web.ui.infopop</module>" >> pom2.xml | |
cat pom.xml | tail -n 2 >> pom2.xml | |
mv pom2.xml pom.xml | |
git add pom.xml | |
git commit -a -m "Move missing plugin org.eclipse.wst.web.ui.infopop from javaee" --signoff | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment