13 [ -z "$start_from" ] && {
14 echo "-s requires a start tree" 1>&2
20 tool_dir=$(dirname "$0")
21 . "$tool_dir/common.sh"
25 echo "$@" | tee -a "$LOG_FILE"
31 "$@" 2>&1 | tee -a "$LOG_FILE"
32 return "${PIPESTATUS[0]}"
38 rbase="$2/${rbase%%:*}"
40 rbid=$(git rev-parse "$rbase")
41 rtid=$(git rev-parse "$rtop")
42 [ "$rbid" = "$rtid" ] && {
46 [ "$(git rev-list HEAD..$rtop)" ] || {
50 execute git clone -s -l -n -q . ../rebase-tmp || {
51 echo Clone failed 1>&2
54 log '$' cd ../rebase-tmp
56 execute git fetch --no-tags ../next "refs/remotes/$rtop:$rtop" || {
57 echo Fetch of top failed 1>&2
60 execute git fetch --no-tags ../next "refs/remotes/$rbase:$rbase" || {
61 echo Fetch of base failed 1>&2
64 execute git checkout "$rtop" || {
65 echo Checkout of top failed 1>&2
68 execute git rebase --onto master "$rbase" || {
69 echo Rebase failed 1>&2
74 execute git pull -f ../rebase-tmp "$rtop" || {
76 echo "$h" >>../merge.debug
77 git diff >>../merge.debug 2>&1
78 git diff 2>&1 | egrep -q '<<<<<|^\*' && {
82 execute rm -rf ../rebase-tmp
85 [ -n "$start_from" ] || {
86 cp /dev/null "$LOG_FILE"
88 execute git checkout master
89 execute git reset --hard stable
90 printf 'Name\t\tSHA1\n----\t\t----\n' > "$SHA1_FILE"
94 heads=$(awk -F '\t' '/^#/ { next; } $2=="quilt" || $2=="git" { printf("%s/%s ", $3, $5); } $2=="branch" { printf("branch/%s ", $1); }' "$CTRL_FILE")
101 [ -n "$start_from" ] && {
102 if [ "$tree" = "$start_from" ]; then
109 [ "$tree" = "branch" ] && {
110 git branch -f "${h#branch/}"
114 hlog=$(git log -1 --oneline "${h/\/*://}") 2>/dev/null
115 old_head=$(git rev-parse HEAD)
116 [ -f "../pre-merge/$tree" ] && {
117 for p in $(cat "../pre-merge/$tree"); do
118 "$bin_dir/do_patch" -n "$p" || {
119 linux-next-notify "premerge patch failed"
124 log Merging "$h" "($hlog)"
127 do_rebase "$h" "$tree"
130 execute git merge "$h" || {
131 echo Merge failed 1>&2
132 echo "$h" >>../merge.debug
133 git diff >>../merge.debug 2>&1
134 um_files=$(git diff 2>&1 | sed -n 's/^\* Unmerged path //p')
135 [ "$um_files" ] && [ -f "../merge-files/$tree" ] && {
136 rm_files=$(grep -F "$um_files" "../merge-files/$tree")
138 "$bin_dir/do_rm" $rm_files
140 git diff 2>&1 | egrep -q '<<<<<|^\*' && {
141 linux-next-notify "new conflict found merging $tree"
142 if [ -f "../merge-fixes/$tree" ]; then
143 echo "Merge fixes exist for this tree:"
144 cat "../merge-fixes/$tree"
148 # [ "$(git status --porcelain)" ] && {
149 GIT_EDITOR=: execute git commit -v -a || {
150 linux-next-notify "next commit failed for $tree"
153 execute git diff -M --stat --summary 'HEAD^..'
158 [ -f "../merge-fixes/$tree" ] && {
159 for p in $(cat "../merge-fixes/$tree"); do
160 "$bin_dir/merge_fix" -n "$p" || {
161 linux-next-notify "merge fix failed for $tree"
167 [ $(echo "$tree" | wc -c) -le 8 ] && tab="\t\t"
168 printf "%s$tab%s\n" $tree $(git rev-parse "${h/\/*://}^{}") >> $SHA1_FILE
169 $no_build && continue
171 # See if we need to build after merging this tree
172 new_head=$(git rev-parse HEAD)
173 [ "$old_head" = "$new_head" ] ||
174 [ "$(git diff ${old_head}.. | wc -c)" -eq 0 ] ||
179 do_build=$(awk -F '\t' '/^[^#]/ && $3=="'$tree'" { print $6; }' "$CTRL_FILE")
180 [ "$do_build" = "yes" ] ||
182 git push -f "${build_host}${build_host:+:}${build_dir}" master:refs/heads/next || {
183 echo git push failed 1>&2
184 linux-next-notify "push failed for $tree"
187 [ -x "../pre-build/$tree" ] && {
188 "../pre-build/$tree" || {
189 echo Prebuild script failed 1>&2
190 linux-next-notify "pre-build script failed for $tree"
194 "$bin_dir/do_build" "$tree" || {
195 echo Build failed 1>&2
196 linux-next-notify "build failed for $tree"