Index: tools/merge-to-branch.sh |
diff --git a/tools/merge-to-branch.sh b/tools/merge-to-branch.sh |
index 85b64d794920ad020488d0bb839b17466364c455..aa590a313ca096311e1d1b81c3b51087895e28ea 100755 |
--- a/tools/merge-to-branch.sh |
+++ b/tools/merge-to-branch.sh |
@@ -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 |