Commit c12a9ed6 authored by danno@chromium.org's avatar danno@chromium.org

Allow a commit message to be specified to merge-to-branch.sh

R=jkummerow@chromium.org

Review URL: https://chromiumcodereview.appspot.com/9844015

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11181 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 552393c3
......@@ -77,20 +77,27 @@ delete_branch() {
persist() {
local VARNAME=$1
local FILE="$PERSISTFILE_BASENAME-$VARNAME"
echo "${!VARNAME}" > $FILE
local VALUE="${!VARNAME}"
if [ -z "$VALUE" ] ; then
VALUE="__EMPTY__"
fi
echo "$VALUE" > $FILE
}
restore() {
local VARNAME=$1
local FILE="$PERSISTFILE_BASENAME-$VARNAME"
local VALUE="$(cat $FILE)"
[[ -z "$VALUE" ]] && die "Variable '$VARNAME' could not be restored."
if [ "$VALUE" == "__EMPTY__" ] ; then
VALUE=""
fi
eval "$VARNAME=\"$VALUE\""
}
restore_if_unset() {
local VARNAME=$1
[[ -z "${!VARNAME}" ]] && restore "$VARNAME"
[[ -z "${!VARNAME}" ]] && die "Variable '$VARNAME' could not be restored."
}
initial_environment_checks() {
......
......@@ -49,6 +49,7 @@ OPTIONS:
-h Show this message
-s Specify the step where to start work. Default: 0.
-p Specify a patch file to apply as part of the merge
-m Specify a commit message for the patch
-r Reverse specified patches
EOF
}
......@@ -69,7 +70,7 @@ restore_patch_commit_hashes_if_unset() {
########## Option parsing
while getopts ":hs:fp:r" OPTION ; do
while getopts ":hs:fp:rm:" OPTION ; do
case $OPTION in
h) usage
exit 0
......@@ -80,6 +81,8 @@ while getopts ":hs:fp:r" OPTION ; do
;;
r) REVERSE_PATCH="--reverse"
;;
m) NEW_COMMIT_MSG=$OPTARG
;;
s) START_STEP=$OPTARG
;;
?) echo "Illegal option: -$OPTARG"
......@@ -101,8 +104,13 @@ touch "$ALREADY_MERGING_SENTINEL_FILE"
initial_environment_checks
if [ $START_STEP -le $CURRENT_STEP ] ; then
if [ ${#@} -lt 2 ] && [ -z "$EXTRA_PATCH" ] ; then
die "Either a patch file or revision numbers must be specified"
if [ ${#@} -lt 2 ] ; then
if [ -z "$EXTRA_PATCH" ] ; then
die "Either a patch file or revision numbers must be specified"
fi
if [ -z "$NEW_COMMIT_MSG" ] ; then
die "You must specify a merge comment if no patches are specified"
fi
fi
echo ">>> Step $CURRENT_STEP: Preparation"
MERGE_TO_BRANCH=$1
......@@ -134,9 +142,7 @@ revisions associated with the patches."
REVISION_LIST="$REVISION_LIST r$REVISION"
let current+=1
done
if [ -z "$REVISION_LIST" ] ; then
NEW_COMMIT_MSG="Applied patch to $MERGE_TO_BRANCH branch."
else
if [ -n "$REVISION_LIST" ] ; then
if [ -n "$REVERSE_PATCH" ] ; then
NEW_COMMIT_MSG="Rollback of$REVISION_LIST in $MERGE_TO_BRANCH branch."
else
......
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