+ 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 "$@"
+ cd "$d0"
+ done
+ ;;
+ save-patches)
+ outfile=$1
+ patchdir=`mktemp -d -t save-patches.XXXXXX`
+ for d in $repos; do
+ enter "$d0/$d" verbose
+ git branch -v -v | cut -c 3- | {
+ i=0
+ while read -r BRANCH REV UPSTREAM TEXT; do
+ case "$UPSTREAM" in
+ \[*)
+ UPSTREAM=${UPSTREAM#\[}
+ UPSTREAM=${UPSTREAM%\]}
+ UPSTREAM=${UPSTREAM%:*}
+ TRACK=true
+ ;;
+ *)
+ UPSTREAM=origin/"`repobranch "$d"`"
+ TRACK=false
+ ;;
+ esac
+ if [ x"$REV" = x"->" ]; then
+ continue
+ fi
+ if git format-patch -o "$patchdir/$i" "$UPSTREAM".."$BRANCH"; then
+ echo "$d" > "$patchdir/$i/info.txt"
+ echo "$BRANCH" >> "$patchdir/$i/info.txt"
+ echo "$UPSTREAM" >> "$patchdir/$i/info.txt"
+ echo "$TRACK" >> "$patchdir/$i/info.txt"
+ i=$(($i+1))
+ else
+ rm -rf "$patchdir/$i"
+ fi
+ done
+ }
+ done
+ ( cd "$patchdir" && tar cvzf - . ) > "$outfile"
+ rm -rf "$patchdir"
+ ;;
+ restore-patches)
+ infile=$1
+ patchdir=`mktemp -d -t restore-patches.XXXXXX`
+ ( cd "$patchdir" && tar xvzf - ) < "$infile"
+ # detach the head
+ for P in "$patchdir"/*/info.txt; do
+ D=${P%/info.txt}
+ exec 3<"$P"
+ read -r d <&3
+ read -r BRANCH <&3
+ read -r UPSTREAM <&3
+ read -r TRACK <&3
+ verbose git checkout HEAD^0
+ verbose git branch -D "$BRANCH"
+ if [ x"$TRACK" = x"true" ]; then
+ verbose git checkout --track -b "$BRANCH" "$UPSTREAM"
+ else
+ verbose git branch -b "$BRANCH" "$UPSTREAM"
+ fi
+ verbose git am "$D"
+ done
+ rm -rf "$patchdir"
+ ;;
+ admin-merge)
+ for d in $repos; do
+ enter "$d0/$d" verbose
+ git rev-parse "$1/$2" || continue
+ # 1. review
+ {
+ git log HEAD.."$1/$2"
+ git diff HEAD..."$1/$2"
+ } | less
+ a=
+ while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
+ echo "Merge \"$1/$2\" into `git symbolic-ref HEAD` of $d?"
+ read -r a
+ done
+ if [ x"$a" = x"y" ]; then
+ git merge "$1/$2"
+ cd "$d0"
+ a=
+ if ! "$SELF" compile; then
+ a=n
+ fi
+ cd "$d0/$d"
+ while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
+ echo "Still merge \"$1/$2\" into `git symbolic-ref HEAD` of $d? Maybe you want to test first."
+ read -r a
+ done
+ if [ x"$a" = x"y" ]; then
+ git push origin HEAD
+ git push "$1" :"$2"
+ else
+ git reset --hard HEAD@{1}
+ fi
+ fi
+ done