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 15set -e 16 17rev="" 18proj="" 19 20function 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 26while [ $# -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 47done 48 49if [ "x$rev" = "x" -o "x$proj" = "x" ]; then 50 echo "error: need to specify project and revision" 51 echo 52 usage 53 exit 1 54fi 55 56if ! svn ls http://llvm.org/svn/llvm-project/$proj/trunk > /dev/null 2>&1 ; then 57 echo "error: invalid project: $proj" 58 exit 1 59fi 60 61tempfile=`mktemp /tmp/merge.XXXXXX` || exit 1 62 63echo "Merging r$rev:" > $tempfile 64svn log -c $rev http://llvm.org/svn/llvm-project/$proj/trunk >> $tempfile 2>&1 65 66cd $proj.src 67echo "# Updating tree" 68svn up 69echo "# Merging r$rev into $proj" 70svn merge -c $rev https://llvm.org/svn/llvm-project/$proj/trunk . || exit 1 71echo "# Committing changes" 72svn commit -F $tempfile || exit 1 73rm -f $tempfile 74exit 0 75