2011-10-16 01:54:03 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#===-- merge.sh - Test the LLVM release candidates -------------------------===#
|
|
|
|
#
|
|
|
|
# The LLVM Compiler Infrastructure
|
|
|
|
#
|
|
|
|
# This file is distributed under the University of Illinois Open Source
|
|
|
|
# License.
|
|
|
|
#
|
|
|
|
#===------------------------------------------------------------------------===#
|
|
|
|
#
|
|
|
|
# Merge a revision into a project.
|
|
|
|
#
|
|
|
|
#===------------------------------------------------------------------------===#
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
rev=""
|
|
|
|
proj=""
|
2015-08-04 00:47:58 +00:00
|
|
|
revert="no"
|
2016-06-01 14:16:00 +00:00
|
|
|
srcdir=""
|
2011-10-16 01:54:03 +00:00
|
|
|
|
2016-01-13 19:48:50 +00:00
|
|
|
usage() {
|
2011-10-16 01:54:03 +00:00
|
|
|
echo "usage: `basename $0` [OPTIONS]"
|
|
|
|
echo " -proj PROJECT The project to merge the result into"
|
|
|
|
echo " -rev NUM The revision to merge into the project"
|
2015-08-04 00:47:58 +00:00
|
|
|
echo " -revert Revert rather than merge the commit"
|
2016-06-01 14:16:00 +00:00
|
|
|
echo " -srcdir The root of the project checkout"
|
2011-10-16 01:54:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case $1 in
|
|
|
|
-rev | --rev | -r )
|
|
|
|
shift
|
2016-07-18 20:06:27 +00:00
|
|
|
rev=$1
|
2011-10-16 01:54:03 +00:00
|
|
|
;;
|
|
|
|
-proj | --proj | -project | --project | -p )
|
|
|
|
shift
|
|
|
|
proj=$1
|
|
|
|
;;
|
2016-05-29 22:09:54 +00:00
|
|
|
--srcdir | -srcdir | -s)
|
|
|
|
shift
|
|
|
|
srcdir=$1
|
|
|
|
;;
|
2011-10-16 01:54:03 +00:00
|
|
|
-h | -help | --help )
|
|
|
|
usage
|
|
|
|
;;
|
2015-08-04 00:47:58 +00:00
|
|
|
-revert | --revert )
|
|
|
|
revert="yes"
|
|
|
|
;;
|
2011-10-16 01:54:03 +00:00
|
|
|
* )
|
|
|
|
echo "unknown option: $1"
|
|
|
|
echo ""
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2016-05-29 22:09:54 +00:00
|
|
|
if [ -z "$srcdir" ]; then
|
|
|
|
srcdir="$proj.src"
|
|
|
|
fi
|
|
|
|
|
2011-10-16 01:54:03 +00:00
|
|
|
if [ "x$rev" = "x" -o "x$proj" = "x" ]; then
|
|
|
|
echo "error: need to specify project and revision"
|
|
|
|
echo
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! svn ls http://llvm.org/svn/llvm-project/$proj/trunk > /dev/null 2>&1 ; then
|
|
|
|
echo "error: invalid project: $proj"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
tempfile=`mktemp /tmp/merge.XXXXXX` || exit 1
|
|
|
|
|
2015-08-04 00:47:58 +00:00
|
|
|
if [ $revert = "yes" ]; then
|
|
|
|
echo "Reverting r$rev:" > $tempfile
|
|
|
|
else
|
|
|
|
echo "Merging r$rev:" > $tempfile
|
|
|
|
fi
|
2011-10-16 01:54:03 +00:00
|
|
|
svn log -c $rev http://llvm.org/svn/llvm-project/$proj/trunk >> $tempfile 2>&1
|
|
|
|
|
2016-05-29 22:09:54 +00:00
|
|
|
cd "$srcdir"
|
2011-10-16 20:59:25 +00:00
|
|
|
echo "# Updating tree"
|
|
|
|
svn up
|
2015-08-04 00:47:58 +00:00
|
|
|
|
|
|
|
if [ $revert = "yes" ]; then
|
|
|
|
echo "# Reverting r$rev in $proj locally"
|
|
|
|
svn merge -c -$rev . || exit 1
|
|
|
|
else
|
|
|
|
echo "# Merging r$rev into $proj locally"
|
|
|
|
svn merge -c $rev https://llvm.org/svn/llvm-project/$proj/trunk . || exit 1
|
|
|
|
fi
|
2015-01-13 00:07:31 +00:00
|
|
|
|
|
|
|
echo
|
2015-08-04 00:47:58 +00:00
|
|
|
echo "# To commit, run the following in $proj.src/:"
|
2015-01-13 00:07:31 +00:00
|
|
|
echo svn commit -F $tempfile
|
|
|
|
|
2011-10-16 01:54:03 +00:00
|
|
|
exit 0
|