6 while getopts 'ns:' opt; do
21 # shellcheck source=common.sh
22 source "$(dirname "$0")/common.sh"
26 echo "$@" | tee -a "$LOG_FILE"
32 "$@" 2>&1 | tee -a "$LOG_FILE"
33 return "${PIPESTATUS[0]}"
39 linux-next-notify "$1"
42 printf '%s\n' "$2" 1>&2
49 if [ -z "$start_from" ]; then
50 cp /dev/null "$LOG_FILE"
52 execute git checkout master
53 execute git reset --hard stable
54 printf 'Name\t\tSHA1\n----\t\t----\n' > "$SHA1_FILE"
59 $2=="git" { printf("%s/%s ", $3, $5); }
60 $2=="branch" { printf("branch/%s ", $1); }' "$CTRL_FILE")
67 if [ -n "$start_from" ]; then
68 if [ "$tree" = "$start_from" ]; then
75 if [ "$tree" = "branch" ]; then
76 git branch -f "${h#branch/}"
77 linux-next-notify "update branch ${h#branch/}"
81 hlog=$(git log -1 --oneline "$h") 2>/dev/null
82 old_head=$(git rev-parse HEAD)
83 if [ -f "../pre-merge/$tree" ]; then
84 while read -r p <&7; do
85 if ! "$bin_dir/do_patch" -n "$p"; then
86 fix_up "premerge patch failed"
88 done 7<"../pre-merge/$tree"
90 log Merging "$h" "($hlog)"
91 printf -v msg "Merge branch '%s' of %s" "${h#*/}" "$(get_url "$tree")"
92 if ! execute git merge -m "$msg" "$h"; then
93 echo Merge failed 1>&2
94 echo "$h" >>../merge.debug
95 git diff >>../merge.debug 2>&1
97 check_unmerged_files "$tree"
99 if git diff 2>&1 | grep -E -q '<<<<<|^\*'; then
100 if [ -f "../merge-fixes/$tree" ]; then
101 echo "Merge fixes exist for this tree:"
102 cat "../merge-fixes/$tree"
104 fix_up "new conflict found merging $tree"
106 # if [ "$(git status --porcelain)" ]; then
107 if ! execute git commit --no-edit -v -a; then
108 fix_up "next commit failed for $tree"
110 execute git diff -M --stat --summary 'HEAD^..'
115 if [ "${#tree}" -lt 8 ]; then
118 printf '%s%s%s\n' "$tree" "$tab" "$(git rev-parse "$h^{}")" >> "$SHA1_FILE"
120 if [ -f "../merge-fixes/$tree" ]; then
121 while read -r p <&7; do
122 if ! "$bin_dir/merge_fix" -n "$p"; then
123 fix_up "merge fix failed for $tree"
125 done 7<"../merge-fixes/$tree"
132 if ! $need_build; then
133 # See if we need to build after merging this tree
134 if [ -n "$(git diff "$old_head"..)" ]; then
138 if ! $need_build; then
142 if [ "$(get_build_flag "$tree")" != "yes" ]; then
146 repo="${build_host:+$build_host:}${build_dir}"
147 if ! git push -f "$repo" master:refs/heads/next; then
148 fix_up "push failed for $tree" "git push failed"
151 if [ -x "../pre-build/$tree" ] &&
152 ! "../pre-build/$tree"; then
153 fix_up "pre-build script failed for $tree" "Prebuild script failed"
155 if ! "$bin_dir/do_build" "$tree"; then
156 fix_up "build failed for $tree" "Build failed"