Release tag script: add -dry-run flag
authorHans Wennborg <hans@hanshq.net>
Tue, 13 Jan 2015 00:07:22 +0000 (00:07 +0000)
committerHans Wennborg <hans@hanshq.net>
Tue, 13 Jan 2015 00:07:22 +0000 (00:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225735 91177308-0d34-0410-b5e6-96231b3b80d8

utils/release/tag.sh

index 390acaf..b586475 100755 (executable)
@@ -18,17 +18,19 @@ release=""
 rc=""
 rebranch="no"
 projects="llvm cfe dragonegg test-suite compiler-rt libcxx libcxxabi clang-tools-extra polly lldb lld openmp"
+dryrun=""
 
 base_url="https://llvm.org/svn/llvm-project"
 
 function usage() {
-    echo "usage: `basename $0` -release <num> [-rebranch]"
-    echo "usage: `basename $0` -release <num> -rc <num>"
+    echo "usage: `basename $0` -release <num> [-rebranch] [-dry-run]"
+    echo "usage: `basename $0` -release <num> -rc <num> [-dry-run]"
     echo " "
     echo "  -release <num>  The version number of the release"
     echo "  -rc <num>       The release candidate number"
     echo "  -rebranch       Remove existing branch, if present, before branching"
     echo "  -final          Tag final release candidate"
+    echo "  -dry-run        Make no changes to the repository, just print the commands"
 }
 
 function tag_version() {
@@ -38,10 +40,10 @@ function tag_version() {
             if [ $rebranch = "no" ]; then
                 continue
             fi
-            svn remove -m "Removing old release_$branch_release branch for rebranching." \
+            ${dryrun} svn remove -m "Removing old release_$branch_release branch for rebranching." \
                 $base_url/$proj/branches/release_$branch_release
         fi
-        svn copy -m "Creating release_$branch_release branch" \
+        ${dryrun} svn copy -m "Creating release_$branch_release branch" \
             $base_url/$proj/trunk \
             $base_url/$proj/branches/release_$branch_release
     done
@@ -52,10 +54,10 @@ function tag_release_candidate() {
     set -x
     for proj in $projects ; do
         if ! svn ls $base_url/$proj/tags/RELEASE_$tag_release > /dev/null 2>&1 ; then
-            svn mkdir -m "Creating release directory for release_$tag_release." $base_url/$proj/tags/RELEASE_$tag_release
+            ${dryrun} svn mkdir -m "Creating release directory for release_$tag_release." $base_url/$proj/tags/RELEASE_$tag_release
         fi
         if ! svn ls $base_url/$proj/tags/RELEASE_$tag_release/$rc > /dev/null 2>&1 ; then
-            svn copy -m "Creating release candidate $rc from release_$tag_release branch" \
+            ${dryrun} svn copy -m "Creating release candidate $rc from release_$tag_release branch" \
                 $base_url/$proj/branches/release_$branch_release \
                 $base_url/$proj/tags/RELEASE_$tag_release/$rc
         fi
@@ -79,6 +81,9 @@ while [ $# -gt 0 ]; do
         -final | --final )
             rc="final"
             ;;
+        -dry-run | --dry-run )
+            dryrun="echo"
+            ;;
         -h | --help | -help )
             usage
             exit 0