summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2013-05-17 15:14:15 +0300
committerLeif Åstrand <leif@vaadin.com>2013-05-17 15:14:59 +0300
commit1205e87be7f306e6c307190ae6423ee64f1c7b17 (patch)
tree670858e0940b45b0b42fdb7d30bb2f07e356c443 /scripts
parenta52ceb96590333bbfcb7ddad4815c88c49ac97ab (diff)
parent9b6b735752e2f30bcdf6a521e031a8de22343bb0 (diff)
downloadvaadin-framework-1205e87be7f306e6c307190ae6423ee64f1c7b17.tar.gz
vaadin-framework-1205e87be7f306e6c307190ae6423ee64f1c7b17.zip
Merge commit 'a52ceb96590333' into 7.1
Conflicts: theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java Change-Id: I049a08a5d129b8072bf91554ca0eab0d44e537e3
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/automerge7.sh131
1 files changed, 131 insertions, 0 deletions
diff --git a/scripts/automerge7.sh b/scripts/automerge7.sh
new file mode 100755
index 0000000000..ea83b2e52c
--- /dev/null
+++ b/scripts/automerge7.sh
@@ -0,0 +1,131 @@
+#!/bin/bash
+
+FROM=7.0
+TO=7.1
+
+FROM_HEAD=origin/$FROM
+PUSH="origin HEAD:refs/for/$TO"
+
+show() {
+ sCommit=$1
+ if [ "$sCommit" == "" ]
+ then
+ echo "show() missing commit id"
+ exit 1
+ fi
+ git show -s $sCommit
+}
+merge() {
+ mCommit=$1
+ if [ "$mCommit" == "" ]
+ then
+ echo "merge() missing commit id"
+ exit 1
+ fi
+
+# echo "merge($mCommit)"
+
+ git merge -m "Should be overwritten by merge script" $mCommit $2
+ if [ "$?" != "0" ]
+ then
+ echo "Merge failed for commit $mCommit"
+ echo "Manual merge is needed"
+ exit 2
+ fi
+ # Add a change id using git hook
+ git commit --amend --no-edit
+
+}
+
+pushMerged() {
+# echo "pushMerged()"
+ git push $PUSH
+ if [ "$?" != "0" ]
+ then
+ echo "Push failed!"
+ exit 2
+ fi
+}
+
+maybe_commit_and_push() {
+# echo "maybe_commit_and_push()"
+ cpCommit=$1
+ if [ "$cpCommit" == "" ]
+ then
+ # 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_HEAD\n\n$cpCommitMsg"|git commit --amend -F -
+ pushMerged
+}
+
+nothingToCommit=`git status | grep "nothing to commit"`
+if [ "$nothingToCommit" == "" ]
+then
+ git status
+ echo "Can not merge when there are unstaged changes."
+ exit 1;
+fi
+
+git checkout $TO
+git fetch
+
+pending=`git log $TO..$FROM_HEAD --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 "$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
+ echo -e "No-op merge from $FROM_HEAD\n\n$commitMsg"|git commit --amend -F -
+ pushMerged
+ elif [ "$mergeDirective" == "manual" ]
+ then
+ 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 "$pendingCommitMessage"
+ pendingCommit=
+ pendingCommitMessage=
+ echo
+ echo "Commit $commit contains an unknown merge directive, Merge: $mergeDirective"
+ echo "Stopping merge."
+ show $commit
+ exit 3
+ fi
+done
+
+# Push any pending merges
+maybe_commit_and_push $pendingCommit "$pendingCommitMessage"