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