[llvm-exegesis] Fix missing std::move.
[llvm-complete.git] / utils / release / tag.sh
blob89aab6b1e7b438ea6709447624d0dbff8fb345d3
1 #!/bin/sh
2 #===-- tag.sh - Tag the LLVM release candidates ----------------------------===#
4 # The LLVM Compiler Infrastructure
6 # This file is distributed under the University of Illinois Open Source
7 # License.
9 #===------------------------------------------------------------------------===#
11 # Create branches and release candidates for the LLVM release.
13 #===------------------------------------------------------------------------===#
15 set -e
17 release=""
18 rc=""
19 rebranch="no"
20 projects="llvm cfe test-suite compiler-rt libcxx libcxxabi clang-tools-extra polly lldb lld openmp libunwind debuginfo-tests"
21 dryrun=""
22 revision="HEAD"
24 base_url="https://llvm.org/svn/llvm-project"
26 usage() {
27 echo "usage: `basename $0` -release <num> [-rebranch] [-revision <num>] [-dry-run]"
28 echo "usage: `basename $0` -release <num> -rc <num> [-dry-run]"
29 echo " "
30 echo " -release <num> The version number of the release"
31 echo " -rc <num> The release candidate number"
32 echo " -rebranch Remove existing branch, if present, before branching"
33 echo " -final Tag final release candidate"
34 echo " -revision <num> Revision to branch off (default: HEAD)"
35 echo " -dry-run Make no changes to the repository, just print the commands"
38 tag_version() {
39 set -x
40 for proj in $projects; do
41 if svn ls $base_url/$proj/branches/release_$branch_release > /dev/null 2>&1 ; then
42 if [ $rebranch = "no" ]; then
43 continue
45 ${dryrun} svn remove -m "Removing old release_$branch_release branch for rebranching." \
46 $base_url/$proj/branches/release_$branch_release
48 ${dryrun} svn copy -m "Creating release_$branch_release branch off revision ${revision}" \
49 -r ${revision} \
50 $base_url/$proj/trunk \
51 $base_url/$proj/branches/release_$branch_release
52 done
53 set +x
56 tag_release_candidate() {
57 set -x
58 for proj in $projects ; do
59 if ! svn ls $base_url/$proj/tags/RELEASE_$tag_release > /dev/null 2>&1 ; then
60 ${dryrun} svn mkdir -m "Creating release directory for release_$tag_release." $base_url/$proj/tags/RELEASE_$tag_release
62 if ! svn ls $base_url/$proj/tags/RELEASE_$tag_release/$rc > /dev/null 2>&1 ; then
63 ${dryrun} svn copy -m "Creating release candidate $rc from release_$tag_release branch" \
64 $base_url/$proj/branches/release_$branch_release \
65 $base_url/$proj/tags/RELEASE_$tag_release/$rc
67 done
68 set +x
71 while [ $# -gt 0 ]; do
72 case $1 in
73 -release | --release )
74 shift
75 release=$1
77 -rc | --rc )
78 shift
79 rc="rc$1"
81 -rebranch | --rebranch )
82 rebranch="yes"
84 -final | --final )
85 rc="final"
87 -revision | --revision )
88 shift
89 revision="$1"
91 -dry-run | --dry-run )
92 dryrun="echo"
94 -h | --help | -help )
95 usage
96 exit 0
98 * )
99 echo "unknown option: $1"
100 usage
101 exit 1
103 esac
104 shift
105 done
107 if [ "x$release" = "x" ]; then
108 echo "error: need to specify a release version"
109 echo
110 usage
111 exit 1
114 branch_release=`echo $release | sed -e 's,\([0-9]*\.[0-9]*\).*,\1,' | sed -e 's,\.,,g'`
115 tag_release=`echo $release | sed -e 's,\.,,g'`
117 if [ "x$rc" = "x" ]; then
118 tag_version
119 else
120 if [ "$revision" != "HEAD" ]; then
121 echo "error: cannot use -revision with -rc"
122 echo
123 usage
124 exit 1
127 tag_release_candidate
130 exit 0