llvm-mirror/utils/release/merge.sh
Chandler Carruth ae65e281f3 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
2019-01-19 08:50:56 +00:00

101 lines
2.3 KiB
Bash
Executable File

#!/bin/sh
#===-- merge.sh - Test the LLVM release candidates -------------------------===#
#
# 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
#
#===------------------------------------------------------------------------===#
#
# Merge a revision into a project.
#
#===------------------------------------------------------------------------===#
set -e
rev=""
proj=""
revert="no"
srcdir=""
usage() {
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"
echo " -revert Revert rather than merge the commit"
echo " -srcdir The root of the project checkout"
}
while [ $# -gt 0 ]; do
case $1 in
-rev | --rev | -r )
shift
rev=$1
;;
-proj | --proj | -project | --project | -p )
shift
proj=$1
;;
--srcdir | -srcdir | -s)
shift
srcdir=$1
;;
-h | -help | --help )
usage
;;
-revert | --revert )
revert="yes"
;;
* )
echo "unknown option: $1"
echo ""
usage
exit 1
;;
esac
shift
done
if [ -z "$srcdir" ]; then
srcdir="$proj.src"
fi
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
if [ $revert = "yes" ]; then
echo "Reverting r$rev:" > $tempfile
else
echo "Merging r$rev:" > $tempfile
fi
svn log -c $rev http://llvm.org/svn/llvm-project/$proj/trunk >> $tempfile 2>&1
cd "$srcdir"
echo "# Updating tree"
svn up
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
echo
echo "# To commit, run the following in $srcdir/:"
echo svn commit -F $tempfile
exit 0