]> git.ozlabs.org Git - next-scripts/blobdiff - do_merge
do_merge: deref possible tags before saving the SHA1s
[next-scripts] / do_merge
index 0d1cc1b1f62bc24d7843ef928175947dbfd2dd2f..888dd251c05bacfcb1e76ed33937adc87eda6034 100755 (executable)
--- a/do_merge
+++ b/do_merge
@@ -83,7 +83,7 @@ do_rebase()
 
 [ -n "$start_from" ] || {
        cp /dev/null $LOG_FILE
-       execute date
+       execute date -R
        execute git checkout master
        execute git reset --hard stable
        printf 'Name\t\tSHA1\n----\t\t----\n' > $SHA1_FILE
@@ -106,8 +106,16 @@ for h in $heads; do
        }
 
        hlog=$(git log -1 --oneline ${h/\/*://}) 2>/dev/null
-       log Merging $h "($hlog)"
        old_head=$(git rev-parse HEAD)
+       [ -f "../pre-merge/$tree" ] && {
+               for p in $(cat "../pre-merge/$tree"); do
+                       "$bin_dir/do_patch" -n "$p" || {
+                               notify-send -u critical -t 0 "premerge patch failed"
+                               bash -i || exit
+                       }
+               done
+       }
+       log Merging $h "($hlog)"
        case "$h" in
        *:*)
                do_rebase $h $tree
@@ -117,24 +125,44 @@ for h in $heads; do
                        echo Merge failed 1>&2
                        echo $h >>../merge.debug
                        git diff >>../merge.debug 2>&1
+                       um_files=$(git diff 2>&1 | sed -n 's/^\* Unmerged path //p')
+                       [ "$um_files" ] && [ -f "../merge-files/$tree" ] && {
+                               rm_files=$(grep -F "$um_files" "../merge-files/$tree")
+                               [ "$rm_files" ] &&
+                                       "$bin_dir/do_rm" $rm_files
+                       }
                        git diff 2>&1 | egrep -q '<<<<<|^\*' && {
+                               notify-send -t 0 -u critical "linux-next new conflict found merging $tree!"
+                               pushover "linux-next new conflict found merging $tree!"
+                               if [ -f "../merge-fixes/$tree" ]; then
+                                       echo "Merge fixes exist for this tree:"
+                                       cat "../merge-fixes/$tree"
+                               fi
                                bash -i || exit
                        }
-                       GIT_EDITOR=: execute git commit -v -a
-                       execute git diff -M --stat --summary 'HEAD^..'
+#                      [ "$(git status --porcelain)" ] && {
+                               GIT_EDITOR=: execute git commit -v -a || {
+                                       notify-send -t 0 -u critical "linux-next commit failed for $tree!"
+                                       pushover "linux-next commit failed for $tree!"
+                                       bash -i || exit
+                               }
+                               execute git diff -M --stat --summary 'HEAD^..'
+#                      }
                }
                ;;
        esac
        [ -f "../merge-fixes/$tree" ] && {
                for p in $(cat "../merge-fixes/$tree"); do
                        "$bin_dir/merge_fix" -n "$p" || {
+                               notify-send -t 0 -u critical "linux-next merge fix failed for $tree!"
+                               pushover "linux-next merge fix failed for $tree!"
                                bash -i || exit
                        }
                done
        }
        tab="\t"
        [ $(echo "$tree" | wc -c) -le 8 ] && tab="\t\t"
-       printf "%s$tab%s\n" $tree $(git show-ref --hash "${h/\/*://}") >> $SHA1_FILE
+       printf "%s$tab%s\n" $tree $(git rev-parse "${h/\/*://}^{}") >> $SHA1_FILE
        $no_build && continue
        $need_build || {
                # See if we need to build after merging this tree
@@ -148,14 +176,21 @@ for h in $heads; do
        do_build=$(grep -v '^#' $CTRL_FILE | awk -F '   ' '$3=="'$tree'" { print $6; }')
        [ "$do_build" = "yes" ] ||
                continue
-       git push -f "$build_host":"$build_dir" master:refs/heads/next || {
+       git push -f "${build_host}${build_host:+:}${build_dir}" master:refs/heads/next || {
                echo git push failed 1>&2
+               notify-send -t 0 -u critical "linux-next push failed for $tree!"
+               pushover "linux-next push failed for $tree!"
                bash -i || exit
        }
        "$bin_dir/do_build" || {
                echo Build failed 1>&2
+               notify-send -t 0 -u critical "linux-next build failed for $tree!"
+               pushover "linux-next build failed for $tree!"
                bash -i || exit
        }
+
+       notify-send -u normal "Merge and build of $tree successful"
+
        need_build=false
 done