Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save robstryker/2aeec38f3c70f674c606d33a51e7eb99 to your computer and use it in GitHub Desktop.
Save robstryker/2aeec38f3c70f674c606d33a51e7eb99 to your computer and use it in GitHub Desktop.
Better script for shallow (master-only) merge of wtp repos.
START_TIME=`date +%s`
# 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 | 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
git clone "http://git.eclipse.org/gitroot/webtools-common/webtools.common.fproj.git"
git clone "http://git.eclipse.org/gitroot/webtools-common/webtools.common.git"
git clone "http://git.eclipse.org/gitroot/webtools-common/webtools.common.snippets.git"
git clone "http://git.eclipse.org/gitroot/webtools-common/webtools.common.tests.git"
cd webtools.common
$LOCAL_PULL_CMD ../webtools.common.fproj/
git add .gitignore
git add pom.xml
git commit -a -m "Merge commit"
$LOCAL_PULL_CMD ../webtools.common.tests/
git add .gitignore
git add pom.xml
git commit -a -m "Merge commit"
$LOCAL_PULL_CMD ../webtools.common.snippets/
git add .gitignore
git add pom.xml
git commit -a -m "Merge commit"
# move snippets. History will only be visible for these two plugins
# you use git log --follow flag. Otherwise, these will appear to have lost
# their history... but they didn't. It's just not shown by default (or in github).
git mv org.eclipse.wst.common.snippets plugins/org.eclipse.wst.common.snippets
git mv org.eclipse.wst.common.snippets.tests tests/org.eclipse.wst.common.snippets.tests
git commit -a -m "Move snippets plugins and tests to proper folders"
wget https://paste.fedoraproject.org/paste/s81US4a1a9-Pyyj0RoumXl5M1UNdIGYhyRLivL9gydE=/raw
mv raw .gitignore
wget https://paste.fedoraproject.org/paste/j5fCj6H4C0uDmL5fUV0pmV5M1UNdIGYhyRLivL9gydE=/raw
mv raw pom.xml
git commit -a -m "Updating root pom and gitignore"
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
wget https://paste.fedoraproject.org/paste/Pk2ms5VEB0EwaK6QXQj14l5M1UNdIGYhyRLivL9gydE=/raw
mv raw ../0002-disable-jst-test.patch
git apply --ignore-whitespace --check ../0002-disable-jst-test.patch
git am --ignore-whitespace < ../0002-disable-jst-test.patch
mvn clean verify -Pbuild-individual-bundles
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