Browse files

Automated merge script

* Checkouts the branch, runs the tests on it and 
  merges if tests are successful
  • Loading branch information...
1 parent d04053b commit 919f1476b4398939b738534f0243993edf3eb581 @pmuir pmuir committed Nov 22, 2010
Showing with 67 additions and 0 deletions.
  1. +67 −0 merge.sh
View
67 merge.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+usage()
+{
+cat << EOF
+usage: $0 options
+
+This script will checkout a branch of Weld, update JBoss AS with it, and run
+all the tests against it. It will then merge the branch to master for final
+review. It will not push the branch to upstream.
+
+OPTIONS:
+ -h Show this usage message
+ -b The name of the branch to checkout
+ -m The name of the branch to merge into, by default "master"
+ -v Be more verbose
+EOF
+}
+
+work()
+{
+echo "Checking out $BRANCH"
+TMP_LOCAL_BRANCH=tmp_local_branch_$BRANCH
+git checkout -b $TMP_LOCAL_BRANCH $BRANCH
+git rebase $BASE_BRANCH
+echo "Rebased $BRANCH onto $BASE_BRANCH"
+echo "Executing $BUILD_COMMAND"
+`$BUILD_COMMAND`
+git checkout $BASE_BRANCH
+echo "Merging $BRANCH into $BASE_BRANCH"
+git merge $TMP_LOCAL_BRANCH
+git status
+}
+
+BRANCH=
+VERBOSE=0
+RUN=1
+BASE_BRANCH="origin/master"
+BUILD_COMMAND="mvn clean install && mvn verify -Dincontainer"
+
+while getopts "vhb:m:" OPTION
+do
+ case $OPTION in
+ h)
+ usage
+ RUN=0
+ ;;
+ b)
+ BRANCH=$OPTARG
+ ;;
+ m)
+ BASE_BRANCH=$OPTARG
+ ;;
+ v)
+ VERBOSE=1
+ ;;
+ [?])
+ usage;
+ RUN=0
+ ;;
+ esac
+done
+
+if [ "$RUN" -eq "1" ]
+then
+ work;
+fi

0 comments on commit 919f147

Please sign in to comment.