Created
August 28, 2018 17:09
-
-
Save nickboldt/2dd3a2a352f4462c0aef1fcef05c4850 to your computer and use it in GitHub Desktop.
merge org.eclipse.tm.terminal into org.eclipse.tm/terminal/
This file contains 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 | |
# merge tm repos into a single repo | |
# 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.9-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 | |
} | |
# Now clone the repos | |
for d in org.eclipse.tm org.eclipse.tm.terminal; do | |
if [[ ! -d ${d} ]]; then | |
git clone ssh://nickb@git.eclipse.org:29418/tm/${d} | |
fi | |
done | |
for d in org.eclipse.tm org.eclipse.tm.terminal; do | |
pushd ${d} | |
gitBranchSettings | |
git reset --hard origin/master | |
popd | |
done | |
# Let's collect all the gitignores into one file to use later | |
for d in org.eclipse.tm.terminal; do | |
pushd ${d} | |
mkdir terminal | |
git mv .gitignore admin features plugins repos CONTRIBUTING terminals.psf readme.txt pom.xml terminal/ | |
git add terminal/ | |
git commit -a -m "Move terminal files into subfolder" --signoff | |
popd | |
done | |
cd org.eclipse.tm | |
# merge repos | |
START_TIME=`date +%s` | |
$LOCAL_PULL_CMD ../org.eclipse.tm.terminal | |
END_TIME=`date +%s` | |
EXEC_TIME=$((END_TIME-START_TIME)) | |
echo $EXEC_TIME " seconds to complete filter branch" | |
# insert terminal module into root pom | |
cat pom.xml | head -n 318 > pom2.xml | |
echo " <!-- Terminal features and plug-ins -->" >> pom2.xml | |
echo " <module>terminal</module>" >> pom2.xml | |
cat pom.xml | tail -n 6 >> pom2.xml | |
mv pom2.xml pom.xml | |
git commit -a -m "Insert terminal module into root pom" --signoff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment