Drop remaining Dragonegg support in release scripts
[oota-llvm.git] / utils / release / merge.sh
1 #!/bin/sh
2 #===-- merge.sh - Test the LLVM release candidates -------------------------===#
3 #
4 #                     The LLVM Compiler Infrastructure
5 #
6 # This file is distributed under the University of Illinois Open Source
7 # License.
8 #
9 #===------------------------------------------------------------------------===#
10 #
11 # Merge a revision into a project.
12 #
13 #===------------------------------------------------------------------------===#
14
15 set -e
16
17 rev=""
18 proj=""
19
20 function usage() {
21     echo "usage: `basename $0` [OPTIONS]"
22     echo "  -proj PROJECT  The project to merge the result into"
23     echo "  -rev NUM       The revision to merge into the project"
24 }
25
26 while [ $# -gt 0 ]; do
27     case $1 in
28         -rev | --rev | -r )
29             shift
30             rev=$1
31             ;;
32         -proj | --proj | -project | --project | -p )
33             shift
34             proj=$1
35             ;;
36         -h | -help | --help )
37             usage
38             ;;
39         * )
40             echo "unknown option: $1"
41             echo ""
42             usage
43             exit 1
44             ;;
45     esac
46     shift
47 done
48
49 if [ "x$rev" = "x" -o "x$proj" = "x" ]; then
50     echo "error: need to specify project and revision"
51     echo
52     usage
53     exit 1
54 fi
55
56 if ! svn ls http://llvm.org/svn/llvm-project/$proj/trunk > /dev/null 2>&1 ; then
57     echo "error: invalid project: $proj"
58     exit 1
59 fi
60
61 tempfile=`mktemp /tmp/merge.XXXXXX` || exit 1
62
63 echo "Merging r$rev:" > $tempfile
64 svn log -c $rev http://llvm.org/svn/llvm-project/$proj/trunk >> $tempfile 2>&1
65
66 cd $proj.src
67 echo "# Updating tree"
68 svn up
69 echo "# Merging r$rev into $proj locally"
70 svn merge -c $rev https://llvm.org/svn/llvm-project/$proj/trunk . || exit 1
71
72 echo
73 echo "# To commit the merge, run the following in $proj.src/:"
74 echo svn commit -F $tempfile
75
76 exit 0