[obj2yaml] - Fix a comment. NFC.
[llvm-complete.git] / utils / release / merge.sh
blobad289b6212ce701148f1cafc7a5185d828461c23
1 #!/bin/sh
2 #===-- merge.sh - Test the LLVM release candidates -------------------------===#
4 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 # See https://llvm.org/LICENSE.txt for license information.
6 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 #===------------------------------------------------------------------------===#
10 # Merge a revision into a project.
12 #===------------------------------------------------------------------------===#
14 set -e
16 rev=""
17 proj=""
18 revert="no"
19 srcdir=""
21 usage() {
22 echo "usage: `basename $0` [OPTIONS]"
23 echo " -proj PROJECT The project to merge the result into"
24 echo " -rev NUM The revision to merge into the project"
25 echo " -revert Revert rather than merge the commit"
26 echo " -srcdir The root of the project checkout"
29 while [ $# -gt 0 ]; do
30 case $1 in
31 -rev | --rev | -r )
32 shift
33 rev=$1
35 -proj | --proj | -project | --project | -p )
36 shift
37 proj=$1
39 --srcdir | -srcdir | -s)
40 shift
41 srcdir=$1
43 -h | -help | --help )
44 usage
46 -revert | --revert )
47 revert="yes"
49 * )
50 echo "unknown option: $1"
51 echo ""
52 usage
53 exit 1
55 esac
56 shift
57 done
59 if [ -z "$srcdir" ]; then
60 srcdir="$proj.src"
63 if [ "x$rev" = "x" -o "x$proj" = "x" ]; then
64 echo "error: need to specify project and revision"
65 echo
66 usage
67 exit 1
70 if ! svn ls http://llvm.org/svn/llvm-project/$proj/trunk > /dev/null 2>&1 ; then
71 echo "error: invalid project: $proj"
72 exit 1
75 tempfile=`mktemp /tmp/merge.XXXXXX` || exit 1
77 if [ $revert = "yes" ]; then
78 echo "Reverting r$rev:" > $tempfile
79 else
80 echo "Merging r$rev:" > $tempfile
82 svn log -c $rev http://llvm.org/svn/llvm-project/$proj/trunk >> $tempfile 2>&1
84 cd "$srcdir"
85 echo "# Updating tree"
86 svn up
88 if [ $revert = "yes" ]; then
89 echo "# Reverting r$rev in $proj locally"
90 svn merge -c -$rev . || exit 1
91 else
92 echo "# Merging r$rev into $proj locally"
93 svn merge -c $rev https://llvm.org/svn/llvm-project/$proj/trunk . || exit 1
96 echo
97 echo "# To commit, run the following in $srcdir/:"
98 echo svn commit -F $tempfile
100 exit 0