Skip to content

Instantly share code, notes, and snippets.

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 robstryker/e79310e3ca09de45bf62c9264ac506e7 to your computer and use it in GitHub Desktop.
Save robstryker/e79310e3ca09de45bf62c9264ac506e7 to your computer and use it in GitHub Desktop.
merge webtools.servertools repos
#!/bin/bash
#
# merge servertools repos into a single repo
# based on https://paste.fedoraproject.org/paste/0tnkOZ4N0kP5AKLul2HLnA/raw
START_TIME=`date +%s`
# in case we have another alias for mv, like 'mv -i'
alias mv=mv
# 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"
else
LOCAL_PULL_CMD="git pull --no-edit "
fi
# handle changes to parent pom
git clone http://git.eclipse.org/gitroot/webtools/webtools.releng.aggregator.git
cd webtools.releng.aggregator
cd wtp-parent
mvn clean install
cd ../../
# Now look at the 3 main (required) servertools repos
git clone "http://git.eclipse.org/gitroot/servertools/webtools.servertools.git"
git clone "http://git.eclipse.org/gitroot/servertools/webtools.servertools.tests.git"
git clone "http://git.eclipse.org/gitroot/servertools/webtools.servertools.docs.git"
# handle the docs
cd webtools.servertools.docs
cd docs
sed -i 's/<artifactId>org.eclipse.webtools.servertools.docs<\/artifactId>/<artifactId>org.eclipse.webtools.servertools<\/artifactId>/g' */pom.xml
cd ../
# Commit the change
git commit -a -m "Prepare for merging servertools and servertools.docs repos" --signoff
cd ../webtools.servertools
$LOCAL_PULL_CMD ../webtools.servertools.docs/
wget https://paste.fedoraproject.org/paste/JF2~zaGZ25svSlPO-mPQ1w/raw
mv raw pom.xml
git add pom.xml
git commit -a -m "Merging servertools.docs into servertools"
# handle required changes in servertools.tests
cd ../webtools.servertools.tests
cd tests
sed -i 's/<artifactId>org.eclipse.webtools.servertools.tests<\/artifactId>/<artifactId>org.eclipse.webtools.servertools<\/artifactId>/g' */pom.xml
cd ../
# Commit the change
git workprofile
git commit -a -m "Prepare for merging servertools and servertools.tests repos" --signoff
cd ../webtools.servertools
$LOCAL_PULL_CMD ../webtools.servertools.tests/
wget https://paste.fedoraproject.org/paste/JF2~zaGZ25svSlPO-mPQ1w/raw
mv raw pom.xml
git add pom.xml
git commit -a -m "Merging servertools.tests into servertools"
# example of applying a patch
#wget https://paste.fedoraproject.org/paste/QnCJFBnZtf167~7K8Nlqul5M1UNdIGYhyRLivL9gydE=/raw
#mv raw ../0001-Fix-poms-throughout-project.patch
#git apply --ignore-whitespace --check ../0001-Fix-poms-throughout-project.patch
#git am --ignore-whitespace < ../0001-Fix-poms-throughout-project.patch
# More patches
cd webtools.servertools
git remote add nboldt https://github.com/nickboldt/webtools.servertools.all.git
git fetch nboldt
git cherry-pick b9fca9b39c5c959d1d6392acc9a8431991c9696f
END_TIME=`date +%s`
EXEC_TIME=$((END_TIME-START_TIME))
echo $EXEC_TIME " seconds execution time"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment