blob: 16fe25c1411df92a4b81ef674582ba5e686044cb [file] [log] [blame]
Renato Golin94cc1042016-04-26 11:02:23 +01001#!/usr/bin/env bash
2
3# This script checks out both LLVM and Clang on the same revision number.
4# It can also revert a commit in the past to check for hidden failures.
5
6validate () {
7 echo $1 | grep -q "^[0-9]\+$"
8}
9
10checkout () {
11 name=$1
12 dir=$2
13 to=$3
14 echo $name
15 if [ -d $dir ]; then
16 cd $dir
17 svn revert .
18 svn up -r $to
19 cd ..
20 else
21 svn co -r $to http://llvm.org/svn/llvm-project/$dir/trunk $dir
22 fi
23}
24
25revert () {
26 dir=$1
27 minus=$2
28 cd $dir
29 svn merge -c -$minus .
30 cd ..
31}
32
33if [ "$1" = "" ]; then
34 echo "Syntax: $0 <revision-to> [<revision-minus>]"
35 exit 1
36fi
37if ! validate $1; then
38 echo "Invalid SVN revision to $1"
39 exit 1
40fi
41if [ "$2" != "" ] && ! validate $2; then
42 echo "Invalid SVN revision minus $2"
43 exit 1
44fi
45
46checkout "LLVM" llvm $1
47if [ "$2" != "" ]; then
48 revert llvm $2
49fi
50
51checkout "Clang" cfe $1
52ln -sf `pwd`/cfe `pwd`/llvm/tools/clang
53if [ "$2" != "" ]; then
54 revert cfe $2
55fi
56
57checkout "Compiler-RT" compiler-rt $1
58ln -sf `pwd`/compiler-rt `pwd`/llvm/projects/compiler-rt
59if [ "$2" != "" ]; then
60 revert compiler-rt $2
61fi