aboutsummaryrefslogtreecommitdiff
path: root/bisect/checkout.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bisect/checkout.sh')
-rwxr-xr-xbisect/checkout.sh61
1 files changed, 61 insertions, 0 deletions
diff --git a/bisect/checkout.sh b/bisect/checkout.sh
new file mode 100755
index 0000000..16fe25c
--- /dev/null
+++ b/bisect/checkout.sh
@@ -0,0 +1,61 @@
+#!/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