X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fxonotic.git;a=blobdiff_plain;f=all;h=c1da7075411b58ce3ade3f895d4d8d00e8076adf;hp=9d6b6b29f88ebc12a0b39b86826b15102e13eda5;hb=64e26c2fba740409c370ca95aed0e5cfb1ee59a1;hpb=17ee74dbb9d3b3068c79429e3f3118a948752264 diff --git a/all b/all index 9d6b6b29..c1da7075 100755 --- a/all +++ b/all @@ -184,7 +184,58 @@ fi cmd=$1 shift +fix_upstream_rebase() +{ + if [ -z "$r_me" ] || [ -z "$r_other" ]; then + return + fi + r_base=`git merge-base "$r_me" "$r_other"` + + # no merge-base? upstream did filter-branch + if [ -n "$r_base" ]; then + # otherwise, check if the two histories are "similar" + r_l_me=`git log --pretty="format:%s" "$r_other".."$r_me" | grep -v "^Merge" | sort -u` + r_l_other=`git log --pretty="format:%s" "$r_me".."$r_other" | grep -v "^Merge" | sort -u` + + # heuristics: upstream rebase/filter-branch if more than 50% of the commits of one of the sides are in the other too + r_lc_me=`echo "$r_l_me" | wc -l` + r_lc_other=`echo "$r_l_other" | wc -l` + r_lc_together=`{ echo "$r_l_me"; echo "$r_l_other"; } | sort -u | wc -l` + r_lc_same=$(($r_lc_me + $r_lc_other - $r_lc_together)) + + if [ $(( $r_lc_same * 2 )) -gt $(( $r_lc_me )) ] || [ $(( $r_lc_same * 2 )) -gt $(( $r_lc_other )) ]; then + if yesno "Probable upstream rebase detected, automatically fix?" 'git log --oneline --graph --date-order --left-right "$r_other"..."$r_me"'; then + git reset --hard "$r_me" + git pull --rebase + return 1 + fi + fi + fi + + return 0 +} + +fix_upstream_rebase_mergeok() +{ + r_me=`git rev-parse --revs-only HEAD^1 2>/dev/null || true` + r_other=`git rev-parse --revs-only HEAD^2 2>/dev/null || true` + fix_upstream_rebase +} + +fix_upstream_rebase_mergefail() +{ + r_me=`git rev-parse --revs-only HEAD 2>/dev/null || true` + r_other=`git rev-parse --revs-only MERGE_HEAD 2>/dev/null || true` + fix_upstream_rebase +} + case "$cmd" in + fix_upstream_rebase) + for d in $repos; do + enter "$d0/$d" verbose + verbose fix_upstream_rebase_mergefail && verbose fix_upstream_rebase_mergeok + done + ;; update|pull) allow_pull=true if [ x"$1" = x"-N" ]; then @@ -205,9 +256,12 @@ case "$cmd" in r=${r#refs/heads/} if git config branch.$r.remote >/dev/null 2>&1; then if ! verbose git pull; then + fix_upstream_rebase_mergefailed || true check_mergeconflict "$d" echo "Pulling failed. Press ENTER to continue, or Ctrl-C to abort." read -r DUMMY + else + fix_upstream_rebase_mergeok || true fi fi @@ -826,11 +880,25 @@ case "$cmd" in makeflags=$4 srcdir=$5 targetfiles=$6 - rsync --delete -zvaSHPAX "$srcdir"/ "$host:$buildpath/" - ssh "$host" ". ~/.profile && cd $buildpath && make clean $maketargets $makeflags" - for f in $targetfiles; do - rsync -zvaSHPAX "$host:$buildpath/${f%:*}" "${f##*:}" - done + case " $HOSTS_THAT_ARE_MYSELF " in + *\ $host\ *) + rsync --delete -zvaSHPAX "$srcdir"/ "$buildpath/" + ( + cd $buildpath + eval make clean $maketargets $makeflags + ) + for f in $targetfiles; do + mv "$buildpath/${f%:*}" "${f##*:}" + done + ;; + *) + rsync --delete -zvaSHPAX "$srcdir"/ "$host:$buildpath/" + ssh "$host" ". ~/.profile && cd $buildpath && make clean $maketargets $makeflags" + for f in $targetfiles; do + rsync -zvaSHPAX "$host:$buildpath/${f%:*}" "${f##*:}" + done + ;; + esac ;; release-compile) suffix=$1 @@ -840,7 +908,7 @@ case "$cmd" in darkplaces_maketargets=$5 darkplaces_files=$6 "$SELF" release-compile-run "xonotic-build-$suffix" /tmp/fteqcc.build."$suffix" "$fteqcc_maketargets" "$makeflags" "fteqcc" "$fteqcc_files" - "$SELF" release-compile-run "xonotic-build-$suffix" /tmp/Darkplaces.build."$suffix" "$darkplaces_maketargets" "$makeflags" "fteqcc" "$darkplaces_files" + "$SELF" release-compile-run "xonotic-build-$suffix" /tmp/Darkplaces.build."$suffix" "$darkplaces_maketargets" "$makeflags" "darkplaces" "$darkplaces_files" ;; release-engine-win32) "$SELF" release-compile win32 \