2011-10-16 03:54:03 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#===-- merge.sh - Test the LLVM release candidates -------------------------===#
|
|
|
|
#
|
2019-01-19 09:50:56 +01:00
|
|
|
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
# See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2011-10-16 03:54:03 +02:00
|
|
|
#
|
|
|
|
#===------------------------------------------------------------------------===#
|
|
|
|
#
|
|
|
|
# Merge a revision into a project.
|
|
|
|
#
|
|
|
|
#===------------------------------------------------------------------------===#
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
rev=""
|
|
|
|
proj=""
|
2015-08-04 02:47:58 +02:00
|
|
|
revert="no"
|
2016-06-01 16:16:00 +02:00
|
|
|
srcdir=""
|
2011-10-16 03:54:03 +02:00
|
|
|
|
2016-01-13 20:48:50 +01:00
|
|
|
usage() {
|
2011-10-16 03:54:03 +02: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 02:47:58 +02:00
|
|
|
echo " -revert Revert rather than merge the commit"
|
2016-06-01 16:16:00 +02:00
|
|
|
echo " -srcdir The root of the project checkout"
|
2011-10-16 03:54:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case $1 in
|
|
|
|
-rev | --rev | -r )
|
|
|
|
shift
|
2016-07-18 22:06:27 +02:00
|
|
|
rev=$1
|
2011-10-16 03:54:03 +02:00
|
|
|
;;
|
|
|
|
-proj | --proj | -project | --project | -p )
|
|
|
|
shift
|
|
|
|
proj=$1
|
|
|
|
;;
|
2016-05-30 00:09:54 +02:00
|
|
|
--srcdir | -srcdir | -s)
|
|
|
|
shift
|
|
|
|
srcdir=$1
|
|
|
|
;;
|
2011-10-16 03:54:03 +02:00
|
|
|
-h | -help | --help )
|
|
|
|
usage
|
|
|
|
;;
|
2015-08-04 02:47:58 +02:00
|
|
|
-revert | --revert )
|
|
|
|
revert="yes"
|
|
|
|
;;
|
2011-10-16 03:54:03 +02:00
|
|
|
* )
|
|
|
|
echo "unknown option: $1"
|
|
|
|
echo ""
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2016-05-30 00:09:54 +02:00
|
|
|
if [ -z "$srcdir" ]; then
|
|
|
|
srcdir="$proj.src"
|
|
|
|
fi
|
|
|
|
|
2011-10-16 03:54:03 +02: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 02:47:58 +02:00
|
|
|
if [ $revert = "yes" ]; then
|
|
|
|
echo "Reverting r$rev:" > $tempfile
|
|
|
|
else
|
|
|
|
echo "Merging r$rev:" > $tempfile
|
|
|
|
fi
|
2011-10-16 03:54:03 +02:00
|
|
|
svn log -c $rev http://llvm.org/svn/llvm-project/$proj/trunk >> $tempfile 2>&1
|
|
|
|
|
2016-05-30 00:09:54 +02:00
|
|
|
cd "$srcdir"
|
2011-10-16 22:59:25 +02:00
|
|
|
echo "# Updating tree"
|
|
|
|
svn up
|
2015-08-04 02:47:58 +02: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 01:07:31 +01:00
|
|
|
|
|
|
|
echo
|
2016-11-12 00:26:28 +01:00
|
|
|
echo "# To commit, run the following in $srcdir/:"
|
2015-01-13 01:07:31 +01:00
|
|
|
echo svn commit -F $tempfile
|
|
|
|
|
2011-10-16 03:54:03 +02:00
|
|
|
exit 0
|