blob: 16fe25c1411df92a4b81ef674582ba5e686044cb [file] [log] [blame]
#!/usr/bin/env bash
# This script checks out both LLVM and Clang on the same revision number.
# It can also revert a commit in the past to check for hidden failures.
validate () {
echo $1 | grep -q "^[0-9]\+$"
}
checkout () {
name=$1
dir=$2
to=$3
echo $name
if [ -d $dir ]; then
cd $dir
svn revert .
svn up -r $to
cd ..
else
svn co -r $to http://llvm.org/svn/llvm-project/$dir/trunk $dir
fi
}
revert () {
dir=$1
minus=$2
cd $dir
svn merge -c -$minus .
cd ..
}
if [ "$1" = "" ]; then
echo "Syntax: $0 <revision-to> [<revision-minus>]"
exit 1
fi
if ! validate $1; then
echo "Invalid SVN revision to $1"
exit 1
fi
if [ "$2" != "" ] && ! validate $2; then
echo "Invalid SVN revision minus $2"
exit 1
fi
checkout "LLVM" llvm $1
if [ "$2" != "" ]; then
revert llvm $2
fi
checkout "Clang" cfe $1
ln -sf `pwd`/cfe `pwd`/llvm/tools/clang
if [ "$2" != "" ]; then
revert cfe $2
fi
checkout "Compiler-RT" compiler-rt $1
ln -sf `pwd`/compiler-rt `pwd`/llvm/projects/compiler-rt
if [ "$2" != "" ]; then
revert compiler-rt $2
fi