Created
January 16, 2018 17:26
-
-
Save robstryker/cf9d6758b092be3c7fe92b64651b32db to your computer and use it in GitHub Desktop.
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 | |
MVN="mvn clean install -fae -e -Dplatform-repo.url=http://download.eclipse.org/eclipse/updates/4.8-I-builds/" | |
# 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 | |
} | |
# handle changes to parent pom | |
if [[ ! -d webtools.releng.aggregator ]]; then git clone http://git.eclipse.org/gitroot/webtools/webtools.releng.aggregator.git; fi | |
pushd webtools.releng.aggregator/wtp-parent | |
gitBranchSettings | |
git reset --hard origin/master | |
${MVN} | |
popd | |
git clone http://git.eclipse.org/gitroot/webservices/webtools.webservices.git | |
if [[ -d ${tmpdirCache}/javaee_tmp_filterbranched ]]; then | |
cp -R ${tmpdirCache}/javaee_tmp_filterbranched webtools.javaee | |
else | |
echo "${tmpdirCache}/javaee_tmp_filterbranched does not exist" | |
git clone http://git.eclipse.org/gitroot/jeetools/webtools.javaee.git | |
cd webtools.javaee | |
git filter-branch --index-filter 'git rm -rf --cached --ignore-unmatch docs/ plugins/ site/ tests/ pom.xml' --prune-empty --tag-name-filter cat -- --all | |
git filter-branch --force --tree-filter \ | |
'mkdir features/javaee-web; mv features/* features/javaee-web/ || true' \ | |
--tag-name-filter cat -- --all | |
END_TIME=`date +%s` | |
EXEC_TIME=$((END_TIME-START_TIME)) | |
echo $EXEC_TIME " seconds to complete filter branch" | |
mkdir ${tmpdirCache} | |
mkdir ${tmpdirCache}/javaee_tmp_filterbranched | |
rm .project .gitignore | |
git commit -a -m "Remove files likely to clash on merge" --signoff | |
cd ../ | |
cp -R webtools.javaee ${tmpdirCache}/javaee_tmp_filterbranched | |
fi | |
cd webtools.webservices | |
$LOCAL_PULL_CMD ../webtools.javaee | |
cat pom.xml | head -n 128 > pom2.xml; | |
cat features/javaee-web/pom.xml | grep "<module>" | sed 's/ *//g' | sed 's/module>org/module>features\/javaee-web\/org/g' | awk '{ print " " $0;}' >> pom2.xml; | |
cat pom.xml | tail -n 15 >> pom2.xml | |
mv pom2.xml pom.xml | |
git commit -a -m "Update root pom" --signoff | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment