summaryrefslogtreecommitdiffstats
path: root/scripts/automerge7.sh
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2013-05-17 15:17:21 +0300
committerVaadin Code Review <review@vaadin.com>2013-05-17 12:54:46 +0000
commit5a9303869ce6912afcb158f6b75b3202d77a40a1 (patch)
tree9b1d1d939227914419f3f866a08c77254e376b59 /scripts/automerge7.sh
parent1205e87be7f306e6c307190ae6423ee64f1c7b17 (diff)
downloadvaadin-framework-5a9303869ce6912afcb158f6b75b3202d77a40a1.tar.gz
vaadin-framework-5a9303869ce6912afcb158f6b75b3202d77a40a1.zip
Commit and push everything before a conflicting commit
Change-Id: Ifdc45e2b0f540ac8212aaca835b9d11c18078eb5
Diffstat (limited to 'scripts/automerge7.sh')
-rwxr-xr-xscripts/automerge7.sh26
1 files changed, 23 insertions, 3 deletions
diff --git a/scripts/automerge7.sh b/scripts/automerge7.sh
index ea83b2e52c..bc3a7be0a4 100755
--- a/scripts/automerge7.sh
+++ b/scripts/automerge7.sh
@@ -67,6 +67,14 @@ maybe_commit_and_push() {
pushMerged
}
+can_merge() {
+ commit=$1
+ git merge --no-commit --no-ff $commit > /dev/null 2>&1
+ result=$?
+ git reset --hard HEAD > /dev/null 2>&1
+ return $result
+}
+
nothingToCommit=`git status | grep "nothing to commit"`
if [ "$nothingToCommit" == "" ]
then
@@ -89,9 +97,21 @@ do
commitMsg=`git log -n 1 --format=oneline --abbrev-commit $commit`
if [ "$mergeDirective" == "" ]
then
- pendingCommit=$commit
- pendingCommitMessage=$pendingCommitMessage"$commitMsg\n"
- echo pendingCommitMessage: $pendingCommitMessage
+ if can_merge $commit
+ then
+ pendingCommit=$commit
+ pendingCommitMessage=$pendingCommitMessage"$commitMsg\n"
+ echo pendingCommitMessage: $pendingCommitMessage
+ else
+ maybe_commit_and_push $pendingCommit "$pendingCommitMessage"
+ pendingCommit=
+ pendingCommitMessage=
+ echo
+ echo "Stopping merge because $commit because of merge conflicts"
+ echo "The following commit must be manually merged."
+ show $commit
+ exit 3
+ fi
elif [ "$mergeDirective" == "no" ]
then
maybe_commit_and_push $pendingCommit "$pendingCommitMessage"