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