aboutsummaryrefslogtreecommitdiff
path: root/bisect/checkout.sh
blob: 16fe25c1411df92a4b81ef674582ba5e686044cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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