6 while ! [ -f ./all ]; do
7 if [ x"`pwd`" = x"/" ]; then
8 echo "Cannot find myself."
9 echo "Please run this script with the working directory inside a Xonotic checkout."
17 # If we are on WINDOWS:
22 # Windows hates users. So this script has to copy itself elsewhere first...
24 cp "$SELF" ../all.xonotic.sh
25 exec ../all.xonotic.sh "$@"
38 if [ -x /usr/bin/md5sum ]; then
40 elif [ -x /bin/md5sum ]; then
42 elif [ -x /usr/bin/cksum ]; then
49 self=`checksum "$SELF"`
52 self_new=`checksum "$SELF"`
53 if [ x"$self" != x"$self_new" ]; then
54 msg "./all has changed."
55 if [ -z "$XONOTIC_FORBID_RERUN_ALL" ]; then
56 msg "Rerunning the requested operation to make sure."
57 export XONOTIC_FORBID_RERUN_ALL=1
60 msg "Please try $SELF update, and then retry your requested operation."
77 echo "the root directory"
87 if git ls-files -u | grep ' 1 '; then
89 echo "MERGE CONFLICT."
90 echo "change into the \"$1\" project directory, and then:"
91 echo "- edit the files mentioned above with your favorite editor,"
92 echo " and fix the conflicts (marked with <<<<<<< blocks)"
93 echo "- for binary files, you can select the files using"
94 echo " git checkout --ours or git checkout --theirs"
95 echo "- when done with a file, 'git add' the file"
96 echo "- when done, 'git commit'"
105 check_mergeconflict "$1"
110 data/xonotic-data.pk3dir
111 data/xonotic-maps.pk3dir
112 data/xonotic-music.pk3dir
113 data/xonotic-nexcompat.pk3dir
115 fteqcc@git://github.com/Blub/qclib.git
116 div0-gittools@git://git.icculus.org/divverent/div0-gittools.git
120 repos=`for X in $repos_urls; do echo "${X%%@*}"; done`
122 if [ "$#" = 0 ]; then
130 base=`git config remote.origin.url`
131 base=${base%xonotic.git}
132 for dcomplete in $repos_urls; do
141 url=$base${d##*/}.git
145 if [ -d "$d0/$d" ]; then
146 enter "$d0/$d" verbose
152 verbose git config remote.origin.url "$url"
156 verbose git config remote.origin.fetch "refs/heads/*:refs/remotes/origin/*"
158 r=`git symbolic-ref HEAD`
160 if git config branch.$r.remote >/dev/null 2>&1; then
161 if ! verbose git pull; then
162 check_mergeconflict "$d"
168 checkself "$cmd" "$@"
170 verbose git remote prune origin
173 verbose git clone "$url" "$d0/$d"
180 if [ -z "$branch" ]; then
186 enter "$d0/$d" verbose
187 if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
189 verbose git checkout "$branch"
190 elif git rev-parse "refs/remotes/$remote/$branch" >/dev/null 2>&1; then
192 verbose git checkout --track -b "$branch" "$remote/$branch"
194 verbose git checkout master
197 checkself "$cmd" "$@"
201 echo "The requested branch was not found in any repository."
209 if [ -z "$branch" ]; then
213 if [ -z "$srcbranch" ]; then
216 if [ -z "$branch" ]; then
219 r=`git symbolic-ref HEAD`
226 dv=`visible_repo_name "$d"`
227 enter "$d0/$d" verbose
229 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
230 echo "Branch in $dv?"
233 if [ x"$a" = x"y" ]; then
234 verbose git push "$remote" "$srcbranch":"$branch"
235 verbose git checkout --track -b "$branch" "$remote/$branch"
246 git branch -a -v -v | cut -c 3- | while read -r BRANCH REV UPSTREAM TEXT; do
249 UPSTREAM=${UPSTREAM#\[}
250 UPSTREAM=${UPSTREAM%\]}
251 UPSTREAM=${UPSTREAM%:*}
254 TEXT="$UPSTREAM $TEXT"
258 if [ x"$REV" = x"->" ]; then
261 BRANCH=${BRANCH#remotes/}
263 if [ -n "$UPSTREAM" ]; then
264 echo -n " (tracking $UPSTREAM)"
273 dv=`visible_repo_name "$d"`
274 enter "$d0/$d" verbose
275 r=`git symbolic-ref HEAD`
277 if git log HEAD..origin/master | grep .; then
278 # we have uncommitted changes
280 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
281 echo "Could merge from \"master\" into \"$r\" in $dv. Do it?"
284 if [ x"$a" = x"y" ]; then
285 if ! verbose git merge origin/master; then
286 check_mergeconflict "$d"
287 exit 1 # this should ALWAYS be fatal
296 dv=`visible_repo_name "$d"`
297 enter "$d0/$d" verbose
298 r=`git symbolic-ref HEAD`
300 if git diff HEAD | grep .; then
301 # we have uncommitted changes
303 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
304 echo "Uncommitted changes in \"$r\" in $dv. Commit?"
307 if [ x"$a" = x"y" ]; then
308 verbose git commit -a
311 if git log "origin/$r".."$r" | grep .; then
313 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
314 echo "Push \"$r\" in $dv?"
317 if [ x"$a" = x"y" ]; then
318 verbose git push `git config "branch.$r.remote" || echo origin` HEAD
325 if [ -z "$MAKEFLAGS" ]; then
326 if [ -f /proc/cpuinfo ]; then
327 ncpus=$((`grep -c '^processor :' /proc/cpuinfo`+0))
328 if [ $ncpus -gt 1 ]; then
333 enter "$d0/fteqcc" verbose
334 verbose make $MAKEFLAGS
335 enter "$d0/data/xonotic-data.pk3dir" verbose
336 verbose make FTEQCC="$d0/fteqcc/fteqcc.bin" $MAKEFLAGS
337 enter "$d0/darkplaces" verbose
338 verbose make $MAKEFLAGS sv-debug
339 verbose make $MAKEFLAGS cl-debug
340 verbose make $MAKEFLAGS sdl-debug
345 sdl|glx|agl|dedicated)
354 if ! [ -x "darkplaces/darkplaces$client" ]; then
355 if [ -x "darkplaces/darkplaces$client.exe" ]; then
358 echo "Client darkplaces/darkplaces$client not found, aborting"
362 #verbose "darkplaces/darkplaces$client" -xonotic "$@"
363 verbose "darkplaces/darkplaces$client" -nexuiz -customgamename Xonotic -customgamedirname1 data -customgamedirname2 "" -customgamescreenshotname xonotic -customgameuserdirname xonotic "$@"
367 enter "$d0/$d" verbose
374 patchdir=`mktemp -d -t save-patches.XXXXXX`
376 enter "$d0/$d" verbose
377 git branch -v -v | cut -c 3- | {
379 while read -r BRANCH REV UPSTREAM TEXT; do
382 UPSTREAM=${UPSTREAM#\[}
383 UPSTREAM=${UPSTREAM%\]}
384 UPSTREAM=${UPSTREAM%:*}
388 UPSTREAM=origin/master
392 if [ x"$REV" = x"->" ]; then
395 if git format-patch -o "$patchdir/$i" "$UPSTREAM".."$BRANCH" | grep .; then
396 echo "$d" > "$patchdir/$i/info.txt"
397 echo "$BRANCH" > "$patchdir/$i/info.txt"
398 echo "$UPSTREAM" >> "$patchdir/$i/info.txt"
399 echo "$TRACK" >> "$patchdir/$i/info.txt"
402 rm -rf "$patchdir/$i"
407 ( cd "$patchdir" && tar cvzf - . ) > "$outfile"
412 patchdir=`mktemp -d -t restore-patches.XXXXXX`
413 ( cd "$patchdir" && tar xvzf - ) < "$infile"
415 for P in "$patchdir"/*/info.txt; do
422 verbose git checkout HEAD^0
423 verbose git branch -D "$BRANCH"
424 if [ x"$TRACK" = x"true" ]; then
425 verbose git checkout --track -b "$BRANCH" "$UPSTREAM"
427 verbose git branch -b "$BRANCH" "$UPSTREAM"
438 echo " $SELF branches"
439 echo " $SELF branch [<remote>] <branchname>"
440 echo " $SELF branch <remote> <branchname> <srcbranchname>"
441 echo " $SELF checkout [<remote>] <branchname>"
442 echo " $SELF compile"
443 echo " $SELF run <client> <options>"
444 echo " $SELF each <command>"