Last active
July 6, 2017 19:05
-
-
Save nickboldt/e5175373d33d307ba765a58be3b2562d to your computer and use it in GitHub Desktop.
merge webtools.servertools repos
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 | |
# | |
# 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 | |
git fetch https://git.eclipse.org/r/webtools/webtools.releng.aggregator refs/changes/58/99358/1 && git checkout FETCH_HEAD | |
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 workprofile | |
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 | |
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