13 [ -z "$start_from" ] && {
14 echo "-s requires a start tree" 1>&2
20 . "$(dirname $0)/common.sh"
24 echo "$@" | tee -a $LOG_FILE
30 $@ 2>&1 | tee -a $LOG_FILE
31 return ${PIPESTATUS[0]}
39 rbid=$(git rev-parse $2/$rbase)
40 rtid=$(git rev-parse $2/$rtop)
41 [ "$rbid" = "$rtid" ] && {
45 [ "$(git rev-list HEAD..$2/$rtop)" ] || {
49 execute git clone -s -l -n -q . ../rebase-tmp || {
50 echo Clone failed 1>&2
53 log '$' cd ../rebase-tmp
55 execute git fetch --no-tags ../next refs/remotes/$2/$rtop:$2/$rtop || {
56 echo Fetch of top failed 1>&2
59 execute git fetch --no-tags ../next refs/remotes/$2/$rbase:$2/$rbase || {
60 echo Fetch of base failed 1>&2
63 execute git checkout $2/$rtop || {
64 echo Checkout of top failed 1>&2
67 execute git rebase --onto master $2/$rbase || {
68 echo Rebase failed 1>&2
73 execute git pull -f ../rebase-tmp $2/$rtop || {
75 echo $h >>../merge.debug
76 git diff >>../merge.debug 2>&1
77 git diff 2>&1 | egrep -q '<<<<<|^\*' && {
81 execute rm -rf ../rebase-tmp
84 [ -n "$start_from" ] || {
85 cp /dev/null $LOG_FILE
87 execute git checkout master
88 execute git reset --hard stable
89 printf 'Name\t\tSHA1\n----\t\t----\n' > $SHA1_FILE
93 heads=$(grep -v '^#' $CTRL_FILE | awk -F '\t' '$2=="quilt" || $2=="git" { printf("%s/%s ", $3, $5); }')
100 [ -n "$start_from" ] && {
101 if [ "$tree" = "$start_from" ]; then
108 hlog=$(git log -1 --oneline ${h/\/*://}) 2>/dev/null
109 old_head=$(git rev-parse HEAD)
110 [ -f "../pre-merge/$tree" ] && {
111 for p in $(cat "../pre-merge/$tree"); do
112 "$bin_dir/do_patch" -n "$p" || {
113 notify-send -u critical -t 0 "premerge patch failed"
118 log Merging $h "($hlog)"
124 execute git merge $h || {
125 echo Merge failed 1>&2
126 echo $h >>../merge.debug
127 git diff >>../merge.debug 2>&1
128 um_files=$(git diff 2>&1 | sed -n 's/^\* Unmerged path //p')
129 [ "$um_files" ] && [ -f "../merge-files/$tree" ] && {
130 rm_files=$(grep -F "$um_files" "../merge-files/$tree")
132 "$bin_dir/do_rm" $rm_files
134 git diff 2>&1 | egrep -q '<<<<<|^\*' && {
135 notify-send -u critical -t 0 "merge failed"
138 # [ "$(git status --porcelain)" ] && {
139 GIT_EDITOR=: execute git commit -v -a
140 execute git diff -M --stat --summary 'HEAD^..'
145 [ -f "../merge-fixes/$tree" ] && {
146 for p in $(cat "../merge-fixes/$tree"); do
147 "$bin_dir/merge_fix" -n "$p" || {
148 notify-send -u critical -t 0 "post merge patch failed"
154 [ $(echo "$tree" | wc -c) -le 8 ] && tab="\t\t"
155 printf "%s$tab%s\n" $tree $(git rev-parse "${h/\/*://}") >> $SHA1_FILE
156 $no_build && continue
158 # See if we need to build after merging this tree
159 new_head=$(git rev-parse HEAD)
160 [ "$old_head" = "$new_head" ] ||
161 [ "$(git diff ${old_head}.. | wc -c)" -eq 0 ] ||
166 do_build=$(grep -v '^#' $CTRL_FILE | awk -F ' ' '$3=="'$tree'" { print $6; }')
167 [ "$do_build" = "yes" ] ||
169 git push -f "$build_host":"$build_dir" master:refs/heads/next || {
170 echo git push failed 1>&2
171 notify-send -u critical -t 0 "push failed"
174 "$bin_dir/do_build" || {
175 echo Build failed 1>&2
176 notify-send -u critical -t 0 "build failed"