3 LOG_FILE="../merge.log"
5 build_dir="/scratch/sfr/next"
6 build_cmd="bin/build_next"
7 [ "$NEXT_BUILD_HOST" ] && build_host="$NEXT_BUILD_HOST"
8 [ "$NEXT_BUILD_DIR" ] && build_dir="$NEXT_BUILD_DIR"
18 echo "patch does not exist" 1>&2
30 export NEXT_BUILD_HOST="$build_host"
31 export NEXT_BUILD_DIR="$build_dir"
35 echo "$@" | tee -a $LOG_FILE
41 $@ 2>&1 | tee -a $LOG_FILE
42 return ${PIPESTATUS[0]}
45 old_head=$(git rev-parse HEAD)
46 execute git am -3 "$patch" || {
47 echo "git am failed" 1>&2
50 new_head=$(git rev-parse HEAD)
51 [ "$old_head" = "$new_head" ] && {
52 echo "hmmm, looks like the patch was already applied or is unneeded"
55 [ "$(git diff ${old_head}.. | wc -c)" -eq 0 ] && {
56 echo "hmmm, committed soemthing, but diff is empty" 1>&2
60 GIT_EDITOR=: execute git reset 'HEAD^' || {
61 echo "git reset failed" 1>&2
64 execute git add -A . || {
65 echo "git add failed" 1>&2
68 GIT_EDITOR=: execute git commit -v -a --amend || {
69 echo "git commit failed" 1>&2
75 git push -f "$build_host":"$build_dir" master:refs/heads/next || {
76 echo git push failed 1>&2
80 echo "Building using $build_cmd on $build_host"
81 ssh "$build_host" "$build_cmd" || {
82 echo Build failed 1>&2