diff options
author | Artur Signell <artur@vaadin.com> | 2013-04-23 16:27:37 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-04-23 13:38:13 +0000 |
commit | 5a5066a8c3f229874f310008ef4cd33e4fae55de (patch) | |
tree | b0f20e960faaddc1a89fe761fb6db46c876eae17 | |
parent | f8c43317db44bb42c62f8280e8824daa2689ae1f (diff) | |
download | vaadin-framework-5a5066a8c3f229874f310008ef4cd33e4fae55de.tar.gz vaadin-framework-5a5066a8c3f229874f310008ef4cd33e4fae55de.zip |
Include commit id and message in merge commit message
Change-Id: I2557eddcb4fbd4fd1ec5c608a0d73c7fa1b243b6
-rwxr-xr-x | scripts/automerge7.sh | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/scripts/automerge7.sh b/scripts/automerge7.sh index d64f98a185..33f0462267 100755 --- a/scripts/automerge7.sh +++ b/scripts/automerge7.sh @@ -53,48 +53,62 @@ maybe_commit_and_push() { # Nothing to merge currently return fi + cpCommitMsg=$2 + if [ "$cpCommitMsg" == "" ] + then + echo "Internal error, no commit message passed to maybe_commit_and_push()" + exit 1; + fi # echo "maybe_commit_and_push: Merging $cpCommit" merge $cpCommit + echo -e "Merge changes from $FROM\n\n$cpCommitMsg"|git commit --amend -F - pushMerged } git checkout $TO -git pull --rebase +git fetch pending=`git log $TO..$FROM --reverse|grep "^commit "|sed "s/commit //"` pendingCommit= +pendingCommitMessage= for commit in $pending do echo "Checking $commit..." mergeDirective=`git log -n 1 --format=%B $commit|grep "^Merge:"|sed "s/Merge: //"` + commitMsg=`git log -n 1 --format=oneline --abbrev-commit $commit` if [ "$mergeDirective" == "" ] then pendingCommit=$commit + pendingCommitMessage=$pendingCommitMessage"$commitMsg\n" + echo pendingCommitMessage: $pendingCommitMessage elif [ "$mergeDirective" == "no" ] then - maybe_commit_and_push $pendingCommit + maybe_commit_and_push $pendingCommit "$pendingCommitMessage" pendingCommit= + pendingCommitMessage= echo echo "Doing a no-op merge because of Merge: no for $commit" git log -n 1 --format=%B $commit echo # Do a no-op merge git merge $commit -s ours - git commit --amend --no-edit + echo -e "No-op merge from $FROM\n\n$commitMsg"|git commit --amend -F - pushMerged elif [ "$mergeDirective" == "manual" ] then - maybe_commit_and_push $pendingCommit + maybe_commit_and_push $pendingCommit "$pendingCommitMessage" pendingCommit= + pendingCommitMessage= echo echo "Stopping merge at $commit (merge: manual)" echo "The following commit must be manually merged." show $commit exit 3 else - maybe_commit_and_push $pendingCommit + maybe_commit_and_push $pendingCommit "$pendingCommitMessage" pendingCommit= + pendingCommitMessage= echo echo "Commit $commit contains an unknown merge directive, Merge: $mergeDirective" echo "Stopping merge." @@ -104,4 +118,4 @@ do done # Push any pending merges -maybe_commit_and_push $pendingCommit +maybe_commit_and_push $pendingCommit "$pendingCommitMessage" |