Add a -revert option to utils/release/merge.sh
authorHans Wennborg <hans@hanshq.net>
Tue, 4 Aug 2015 00:47:58 +0000 (00:47 +0000)
committerHans Wennborg <hans@hanshq.net>
Tue, 4 Aug 2015 00:47:58 +0000 (00:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243929 91177308-0d34-0410-b5e6-96231b3b80d8

utils/release/merge.sh

index 949c298..93e08c7 100755 (executable)
@@ -16,11 +16,13 @@ set -e
 
 rev=""
 proj=""
+revert="no"
 
 function 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"
 }
 
 while [ $# -gt 0 ]; do
@@ -36,6 +38,9 @@ while [ $# -gt 0 ]; do
         -h | -help | --help )
             usage
             ;;
+        -revert | --revert )
+            revert="yes"
+            ;;
         * )
             echo "unknown option: $1"
             echo ""
@@ -60,17 +65,27 @@ fi
 
 tempfile=`mktemp /tmp/merge.XXXXXX` || exit 1
 
-echo "Merging r$rev:" > $tempfile
+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 $proj.src
 echo "# Updating tree"
 svn up
-echo "# Merging r$rev into $proj locally"
-svn merge -c $rev https://llvm.org/svn/llvm-project/$proj/trunk . || exit 1
+
+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 the merge, run the following in $proj.src/:"
+echo "# To commit, run the following in $proj.src/:"
 echo svn commit -F $tempfile
 
 exit 0