Commit c0465921 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Add -R option to merge-to-branch script to revert from bleeding_edge.

Usage:
tools/merge-to-branch.sh -R 12345 12346

R=machenbach@chromium.org

Review URL: https://codereview.chromium.org/85413004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18048 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 82021a83
...@@ -69,8 +69,9 @@ restore_patch_commit_hashes_if_unset() { ...@@ -69,8 +69,9 @@ restore_patch_commit_hashes_if_unset() {
} }
########## Option parsing ########## Option parsing
REVERT_FROM_BLEEDING_EDGE=0
while getopts ":hs:fp:rm:" OPTION ; do while getopts ":hs:fp:rm:R" OPTION ; do
case $OPTION in case $OPTION in
h) usage h) usage
exit 0 exit 0
...@@ -85,6 +86,9 @@ while getopts ":hs:fp:rm:" OPTION ; do ...@@ -85,6 +86,9 @@ while getopts ":hs:fp:rm:" OPTION ; do
;; ;;
s) START_STEP=$OPTARG s) START_STEP=$OPTARG
;; ;;
R) REVERSE_PATCH="--reverse"
REVERT_FROM_BLEEDING_EDGE=1
;;
?) echo "Illegal option: -$OPTARG" ?) echo "Illegal option: -$OPTARG"
usage usage
exit 1 exit 1
...@@ -104,7 +108,8 @@ touch "$ALREADY_MERGING_SENTINEL_FILE" ...@@ -104,7 +108,8 @@ touch "$ALREADY_MERGING_SENTINEL_FILE"
initial_environment_checks initial_environment_checks
if [ $START_STEP -le $CURRENT_STEP ] ; then if [ $START_STEP -le $CURRENT_STEP ] ; then
if [ ${#@} -lt 2 ] ; then let MIN_EXPECTED_ARGS=2-$REVERT_FROM_BLEEDING_EDGE
if [ ${#@} -lt $MIN_EXPECTED_ARGS ] ; then
if [ -z "$EXTRA_PATCH" ] ; then if [ -z "$EXTRA_PATCH" ] ; then
die "Either a patch file or revision numbers must be specified" die "Either a patch file or revision numbers must be specified"
fi fi
...@@ -113,9 +118,13 @@ if [ $START_STEP -le $CURRENT_STEP ] ; then ...@@ -113,9 +118,13 @@ if [ $START_STEP -le $CURRENT_STEP ] ; then
fi fi
fi fi
echo ">>> Step $CURRENT_STEP: Preparation" echo ">>> Step $CURRENT_STEP: Preparation"
MERGE_TO_BRANCH=$1 if [ $REVERT_FROM_BLEEDING_EDGE==1 ] ; then
[[ -n "$MERGE_TO_BRANCH" ]] || die "Please specify a branch to merge to" MERGE_TO_BRANCH="bleeding_edge"
shift else
MERGE_TO_BRANCH=$1
[[ -n "$MERGE_TO_BRANCH" ]] || die "Please specify a branch to merge to"
shift
fi
persist "MERGE_TO_BRANCH" persist "MERGE_TO_BRANCH"
common_prepare common_prepare
fi fi
...@@ -144,7 +153,11 @@ revisions associated with the patches." ...@@ -144,7 +153,11 @@ revisions associated with the patches."
done done
if [ -n "$REVISION_LIST" ] ; then if [ -n "$REVISION_LIST" ] ; then
if [ -n "$REVERSE_PATCH" ] ; then if [ -n "$REVERSE_PATCH" ] ; then
NEW_COMMIT_MSG="Rollback of$REVISION_LIST in $MERGE_TO_BRANCH branch." if [ $REVERT_FROM_BLEEDING_EDGE -eq 0 ] ; then
NEW_COMMIT_MSG="Rollback of$REVISION_LIST in $MERGE_TO_BRANCH branch."
else
NEW_COMMIT_MSG="Revert$REVISION_LIST."
fi
else else
NEW_COMMIT_MSG="Merged$REVISION_LIST into $MERGE_TO_BRANCH branch." NEW_COMMIT_MSG="Merged$REVISION_LIST into $MERGE_TO_BRANCH branch."
fi; fi;
...@@ -189,14 +202,14 @@ if [ $START_STEP -le $CURRENT_STEP ] ; then ...@@ -189,14 +202,14 @@ if [ $START_STEP -le $CURRENT_STEP ] ; then
fi fi
let CURRENT_STEP+=1 let CURRENT_STEP+=1
if [ $START_STEP -le $CURRENT_STEP ] ; then if [ $START_STEP -le $CURRENT_STEP ] && [ $REVERT_FROM_BLEEDING_EDGE -eq 0 ] ; then
echo ">>> Step $CURRENT_STEP: Prepare $VERSION_FILE." echo ">>> Step $CURRENT_STEP: Prepare $VERSION_FILE."
# These version numbers are used again for creating the tag # These version numbers are used again for creating the tag
read_and_persist_version read_and_persist_version
fi fi
let CURRENT_STEP+=1 let CURRENT_STEP+=1
if [ $START_STEP -le $CURRENT_STEP ] ; then if [ $START_STEP -le $CURRENT_STEP ] && [ $REVERT_FROM_BLEEDING_EDGE -eq 0 ] ; then
echo ">>> Step $CURRENT_STEP: Increment version number." echo ">>> Step $CURRENT_STEP: Increment version number."
restore_if_unset "PATCH" restore_if_unset "PATCH"
NEWPATCH=$(($PATCH + 1)) NEWPATCH=$(($PATCH + 1))
...@@ -234,7 +247,7 @@ if [ $START_STEP -le $CURRENT_STEP ] ; then ...@@ -234,7 +247,7 @@ if [ $START_STEP -le $CURRENT_STEP ] ; then
fi fi
let CURRENT_STEP+=1 let CURRENT_STEP+=1
if [ $START_STEP -le $CURRENT_STEP ] ; then if [ $START_STEP -le $CURRENT_STEP ] && [ $REVERT_FROM_BLEEDING_EDGE -eq 0 ] ; then
echo ">>> Step $CURRENT_STEP: Determine svn commit revision" echo ">>> Step $CURRENT_STEP: Determine svn commit revision"
restore_if_unset "NEW_COMMIT_MSG" restore_if_unset "NEW_COMMIT_MSG"
restore_if_unset "MERGE_TO_BRANCH" restore_if_unset "MERGE_TO_BRANCH"
...@@ -248,7 +261,7 @@ if [ $START_STEP -le $CURRENT_STEP ] ; then ...@@ -248,7 +261,7 @@ if [ $START_STEP -le $CURRENT_STEP ] ; then
fi fi
let CURRENT_STEP+=1 let CURRENT_STEP+=1
if [ $START_STEP -le $CURRENT_STEP ] ; then if [ $START_STEP -le $CURRENT_STEP ] && [ $REVERT_FROM_BLEEDING_EDGE -eq 0 ] ; then
echo ">>> Step $CURRENT_STEP: Create the tag." echo ">>> Step $CURRENT_STEP: Create the tag."
restore_if_unset "SVN_REVISION" restore_if_unset "SVN_REVISION"
restore_version_if_unset "NEW" restore_version_if_unset "NEW"
...@@ -273,9 +286,11 @@ if [ $START_STEP -le $CURRENT_STEP ] ; then ...@@ -273,9 +286,11 @@ if [ $START_STEP -le $CURRENT_STEP ] ; then
restore_if_unset "REVISION_LIST" restore_if_unset "REVISION_LIST"
restore_version_if_unset "NEW" restore_version_if_unset "NEW"
common_cleanup common_cleanup
echo "*** SUMMARY ***" if [ $REVERT_FROM_BLEEDING_EDGE==0 ] ; then
echo "version: $NEWMAJOR.$NEWMINOR.$NEWBUILD.$NEWPATCH" echo "*** SUMMARY ***"
echo "branch: $TO_URL" echo "version: $NEWMAJOR.$NEWMINOR.$NEWBUILD.$NEWPATCH"
echo "svn revision: $SVN_REVISION" echo "branch: $TO_URL"
[[ -n "$REVISION_LIST" ]] && echo "patches:$REVISION_LIST" echo "svn revision: $SVN_REVISION"
[[ -n "$REVISION_LIST" ]] && echo "patches:$REVISION_LIST"
fi
fi fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment