+ git branch -a -v -v | cut -c 3- | while read -r BRANCH REV UPSTREAM TEXT; do
+ case "$UPSTREAM" in
+ \[*)
+ UPSTREAM=${UPSTREAM#\[}
+ UPSTREAM=${UPSTREAM%\]}
+ UPSTREAM=${UPSTREAM%:*}
+ ;;
+ *)
+ TEXT="$UPSTREAM $TEXT"
+ UPSTREAM=
+ ;;
+ esac
+ if [ x"$REV" = x"->" ]; then
+ continue
+ fi
+ BRANCH=${BRANCH#remotes/}
+ echo -n " $BRANCH"
+ if [ -n "$UPSTREAM" ]; then
+ echo -n " (tracking $UPSTREAM)"
+ fi
+ #echo " $TEXT"
+ echo
+ done
+ done
+ ;;
+ branches_short)
+ for d in $repos; do
+ cd "$d0/$d" # am in a pipe, shouldn't use enter
+ git branch -a -v -v | cut -c 3- | sed "s,^,$d ,"
+ cd "$d0"
+ done | {
+ branches_list=
+ # branches_repos_*=
+ while read -r d BRANCH REV UPSTREAM TEXT; do
+ case "$UPSTREAM" in
+ \[*)
+ UPSTREAM=${UPSTREAM#\[}
+ UPSTREAM=${UPSTREAM%\]}
+ UPSTREAM=${UPSTREAM%:*}
+ ;;
+ *)
+ TEXT="$UPSTREAM $TEXT"
+ UPSTREAM=
+ ;;
+ esac
+ if [ x"$REV" = x"->" ]; then
+ continue
+ fi
+ BRANCH=${BRANCH#remotes/}
+ ID=`echo "$BRANCH" | tr -c "A-Za-z0-9." "_"`
+ branches_list="$branches_list $BRANCH" # TEH SORT MAKEZ IT UNIEQ
+ eval "r=\$branches_repos_$ID"
+ r="$r $d:$UPSTREAM"
+ eval "branches_repos_$ID=\$r"
+ done
+ echo -n "$branches_list" | xargs -n 1 echo | sort -u | while IFS= read -r BRANCH; do
+ ID=`echo "$BRANCH" | tr -c "A-Za-z0-9." "_"`
+ eval "r=\$branches_repos_$ID"
+ echo "$BRANCH: $r"
+ done
+ }
+ ;;
+ merge)
+ for d in $repos; do
+ dv=`visible_repo_name "$d"`
+ enter "$d0/$d" verbose
+ r=`git symbolic-ref HEAD`
+ r=${r#refs/heads/}
+ if git log HEAD..origin/"`repobranch "$d"`" | grep .; then
+ # we have uncommitted changes
+ a=
+ while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
+ echo "Could merge from \"`repobranch "$d"`\" into \"$r\" in $dv. Do it?"
+ read -r a
+ done
+ if [ x"$a" = x"y" ]; then
+ if ! verbose git merge origin/"`repobranch "$d"`"; then
+ check_mergeconflict "$d"
+ exit 1 # this should ALWAYS be fatal
+ fi
+ fi
+ fi
+ cd "$d0"
+ done
+ ;;
+ push|commit)
+ submit=$1
+ for d in $repos; do
+ dv=`visible_repo_name "$d"`
+ enter "$d0/$d" verbose
+ r=`git symbolic-ref HEAD`
+ r=${r#refs/heads/}
+ if git diff HEAD | grep .; then
+ # we have uncommitted changes
+ a=
+ while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
+ echo "Uncommitted changes in \"$r\" in $dv. Commit?"
+ read -r a
+ done
+ if [ x"$a" = x"y" ]; then
+ verbose git commit -a
+ fi
+ fi
+ rem=`git config "branch.$r.remote" || echo origin`
+ if { git log "$rem/$r".."$r" || git log origin/"`repobranch "$d"`".."$r"; } | grep .; then
+ a=
+ while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
+ echo "Push \"$r\" in $dv?"
+ read -r a
+ done
+ if [ x"$a" = x"y" ]; then
+ verbose git push "$rem" HEAD
+ fi
+ fi
+ if [ x"$submit" = x"-s" ]; then
+ case "$r" in
+ */*)
+ verbose git push "$rem" HEAD:"${r%%/*}/finished/${r#*/}"
+ ;;
+ esac
+ fi
+ cd "$d0"
+ done
+ ;;
+ compile)
+ if [ -n "$WE_HATE_OUR_USERS" ]; then
+ TARGETS="sv-debug cl-debug"
+ else
+ TARGETS="sv-debug cl-debug sdl-debug"
+ fi
+ case "$1" in
+ sdl)
+ TARGETS="sdl-debug"
+ shift
+ ;;
+ glx|agl|wgl)
+ TARGETS="cl-debug"
+ shift
+ ;;
+ dedicated)
+ TARGETS="sv-debug"
+ shift
+ ;;
+ esac
+ if [ -z "$MAKEFLAGS" ]; then
+ if [ -f /proc/cpuinfo ]; then
+ ncpus=$((`grep -c '^processor :' /proc/cpuinfo`+0))
+ if [ $ncpus -gt 1 ]; then
+ MAKEFLAGS=-j$ncpus
+ fi
+ fi
+ fi
+ enter "$d0/fteqcc" verbose
+ verbose make $MAKEFLAGS
+ enter "$d0/data/xonotic-data.pk3dir" verbose
+ verbose make FTEQCC="$d0/fteqcc/fteqcc.bin" $MAKEFLAGS
+ enter "$d0/darkplaces" verbose
+ for T in $TARGETS; do
+ verbose make $MAKEFLAGS "$T"
+ done
+ ;;
+ run)
+ if [ -n "$WE_HATE_OUR_USERS" ]; then
+ client=
+ export PATH="$d0/misc/buildfiles/w32:$PATH"
+ else
+ client=-sdl
+ fi
+ case "$1" in
+ sdl|glx|agl|dedicated)
+ client=-$1
+ shift
+ ;;
+ wgl)
+ client=
+ shift
+ ;;
+ esac
+ if ! [ -x "darkplaces/darkplaces$client" ]; then
+ if [ -x "darkplaces/darkplaces$client.exe" ]; then
+ client=$client.exe
+ else
+ echo "Client darkplaces/darkplaces$client not found, aborting"
+ exit 1
+ fi
+ fi
+ set -- "darkplaces/darkplaces$client" -nexuiz -customgamename Xonotic -customgamedirname1 data -customgamedirname2 "" -customgamescreenshotname xonotic -customgameuserdirname xonotic "$@"
+ if [ -n "$USE_GDB" ]; then
+ set -- gdb --args "$@"
+ fi
+ "$@"
+ ;;
+ each|foreach)
+ for d in $repos; do
+ enter "$d0/$d" verbose
+ verbose "$@"