3 LOG_FILE="../merge.log"
5 build_dir="/scratch/sfr/next"
6 build_cmd="bin/build_next"
10 [ "$NEXT_BUILD_HOST" ] && build_host="$NEXT_BUILD_HOST"
11 [ "$NEXT_BUILD_DIR" ] && build_host="$NEXT_BUILD_DIR"
20 [ -z "$start_from" ] && {
21 echo "-s requires a start tree" 1>&2
37 echo "$@" | tee -a $LOG_FILE
43 $@ 2>&1 | tee -a $LOG_FILE
44 return ${PIPESTATUS[0]}
52 rbid=$(git rev-parse $2/$rbase)
53 rtid=$(git rev-parse $2/$rtop)
54 [ "$rbid" = "$rtid" ] && {
58 [ "$(git rev-list HEAD..$2/$rtop)" ] || {
62 execute git clone -s -l -n -q . ../rebase-tmp || {
63 echo Clone failed 1>&2
66 log '$' cd ../rebase-tmp
68 execute git fetch --no-tags ../next refs/remotes/$2/$rtop:$2/$rtop || {
69 echo Fetch of top failed 1>&2
72 execute git fetch --no-tags ../next refs/remotes/$2/$rbase:$2/$rbase || {
73 echo Fetch of base failed 1>&2
76 execute git checkout $2/$rtop || {
77 echo Checkout of top failed 1>&2
80 execute git rebase --onto master $2/$rbase || {
81 echo Rebase failed 1>&2
86 execute git pull -f ../rebase-tmp $2/$rtop || {
88 echo $h >>../merge.debug
89 git diff >>../merge.debug 2>&1
90 git diff 2>&1 | egrep -q '<<<<<|^\*' && {
94 execute rm -rf ../rebase-tmp
97 [ -n "$start_from" ] || {
98 cp /dev/null $LOG_FILE
100 execute git checkout master
101 execute git reset --hard stable
104 heads=$(grep -v '^#' ../real_control | awk -F ' ' '$2=="quilt" { printf("quilt/%s ", $3); } $2=="git" { printf("%s/%s ", $3, $5); }')
110 [ "$tree" == "quilt" ] && tree=${h#quilt/}
112 [ -n "$start_from" ] && {
113 if [ "$tree" = "$start_from" ]; then
121 old_head=$(git rev-parse HEAD)
127 execute git merge $h || {
128 echo Merge failed 1>&2
129 echo $h >>../merge.debug
130 git diff >>../merge.debug 2>&1
131 git diff 2>&1 | egrep -q '<<<<<|^\*' && {
134 GIT_EDITOR=: execute git commit -v -a
135 execute git diff -M --stat --summary 'HEAD^..'
139 [ -f "../merge-fixes/$tree" ] && {
140 for p in $(cat "../merge-fixes/$tree"); do
141 ../tools/merge_fix -n "$p" || {
146 [ -x "../pre-build/$tree" ] && {
147 "../pre-build/$tree" || bash -i || exit
149 $no_build && continue
151 # See if we need to build after merging this tree
152 new_head=$(git rev-parse HEAD)
153 [ "$old_head" = "$new_head" ] ||
154 [ "$(git diff ${old_head}.. | wc -c)" -eq 0 ] ||
159 do_build=$(grep -v '^#' ../real_control | awk -F ' ' '$3=="'$tree'" { print $6; }')
160 [ "$do_build" = "yes" ] ||
162 git push -f "$build_host":"$build_dir" master:refs/heads/next || {
163 echo git push failed 1>&2
166 ssh "$build_host" "$build_cmd" || {
167 echo Build failed 1>&2