7 while ! [ -f ./all ]; do
8 if [ x"`pwd`" = x"/" ]; then
9 echo "Cannot find myself."
10 echo "Please run this script with the working directory inside a Xonotic checkout."
18 # If we are on WINDOWS:
23 # Windows hates users. So this script has to copy itself elsewhere first...
25 cp "$SELF" ../all.xonotic.sh
26 export WE_HATE_OUR_USERS=1
27 exec ../all.xonotic.sh "$@"
40 if [ -x /usr/bin/md5sum ]; then
42 elif [ -x /bin/md5sum ]; then
44 elif [ -x /usr/bin/cksum ]; then
51 self=`checksum "$SELF"`
54 self_new=`checksum "$SELF"`
55 if [ x"$self" != x"$self_new" ]; then
56 msg "./all has changed."
57 if [ -z "$XONOTIC_FORBID_RERUN_ALL" ]; then
58 msg "Rerunning the requested operation to make sure."
59 export XONOTIC_FORBID_RERUN_ALL=1
62 msg "Please try $SELF update, and then retry your requested operation."
79 echo "the root directory"
89 if git ls-files -u | grep ' 1 '; then
91 echo "MERGE CONFLICT."
92 echo "change into the \"$1\" project directory, and then:"
93 echo "- edit the files mentioned above with your favorite editor,"
94 echo " and fix the conflicts (marked with <<<<<<< blocks)"
95 echo "- for binary files, you can select the files using"
96 echo " git checkout --ours or git checkout --theirs"
97 echo "- when done with a file, 'git add' the file"
98 echo "- when done, 'git commit'"
107 check_mergeconflict "$1"
112 data/xonotic-data.pk3dir
113 data/xonotic-maps.pk3dir
114 data/xonotic-music.pk3dir
115 data/xonotic-nexcompat.pk3dir
117 fteqcc@git://github.com/Blub/qclib.git
118 div0-gittools@git://git.icculus.org/divverent/div0-gittools.git
122 repos=`for X in $repos_urls; do echo "${X%%@*}"; done`
124 if [ "$#" = 0 ]; then
132 base=`git config remote.origin.url`
133 base=${base%xonotic.git}
134 for dcomplete in $repos_urls; do
143 url=$base${d##*/}.git
147 if [ -d "$d0/$d" ]; then
148 enter "$d0/$d" verbose
154 verbose git config remote.origin.url "$url"
158 verbose git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
159 # TODO remove this line later
161 verbose git config core.autocrlf false
162 verbose git config core.safecrlf false # we don't NEED that...
164 r=`git symbolic-ref HEAD`
166 if git config branch.$r.remote >/dev/null 2>&1; then
167 if ! verbose git pull; then
168 check_mergeconflict "$d"
174 checkself "$cmd" "$@"
176 verbose git remote prune origin
179 verbose git clone "$url" "$d0/$d"
186 if [ -z "$branch" ]; then
192 enter "$d0/$d" verbose
193 if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
195 verbose git checkout "$branch"
196 elif git rev-parse "refs/remotes/$remote/$branch" >/dev/null 2>&1; then
198 verbose git checkout --track -b "$branch" "$remote/$branch"
200 verbose git checkout master
203 checkself "$cmd" "$@"
207 echo "The requested branch was not found in any repository."
215 if [ -z "$branch" ]; then
219 if [ -z "$srcbranch" ]; then
222 if [ -z "$branch" ]; then
225 r=`git symbolic-ref HEAD`
232 dv=`visible_repo_name "$d"`
233 enter "$d0/$d" verbose
235 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
236 echo "Branch in $dv?"
239 if [ x"$a" = x"y" ]; then
240 verbose git push "$remote" "$srcbranch":"$branch"
241 verbose git checkout --track -b "$branch" "$remote/$branch"
252 git branch -a -v -v | cut -c 3- | while read -r BRANCH REV UPSTREAM TEXT; do
255 UPSTREAM=${UPSTREAM#\[}
256 UPSTREAM=${UPSTREAM%\]}
257 UPSTREAM=${UPSTREAM%:*}
260 TEXT="$UPSTREAM $TEXT"
264 if [ x"$REV" = x"->" ]; then
267 BRANCH=${BRANCH#remotes/}
269 if [ -n "$UPSTREAM" ]; then
270 echo -n " (tracking $UPSTREAM)"
279 dv=`visible_repo_name "$d"`
280 enter "$d0/$d" verbose
281 r=`git symbolic-ref HEAD`
283 if git log HEAD..origin/master | grep .; then
284 # we have uncommitted changes
286 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
287 echo "Could merge from \"master\" into \"$r\" in $dv. Do it?"
290 if [ x"$a" = x"y" ]; then
291 if ! verbose git merge origin/master; then
292 check_mergeconflict "$d"
293 exit 1 # this should ALWAYS be fatal
303 dv=`visible_repo_name "$d"`
304 enter "$d0/$d" verbose
305 r=`git symbolic-ref HEAD`
307 if git diff HEAD | grep .; then
308 # we have uncommitted changes
310 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
311 echo "Uncommitted changes in \"$r\" in $dv. Commit?"
314 if [ x"$a" = x"y" ]; then
315 verbose git commit -a
318 rem=`git config "branch.$r.remote" || echo origin`
319 if git log "$rem/$r".."$r" | grep .; then
321 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
322 echo "Push \"$r\" in $dv?"
325 if [ x"$a" = x"y" ]; then
326 verbose git push "$rem" HEAD
329 if [ x"$submit" = x"-s" ]; then
332 verbose git push "$rem" HEAD:"${r%%/*}/finished/${r#*/}"
340 if [ -z "$MAKEFLAGS" ]; then
341 if [ -f /proc/cpuinfo ]; then
342 ncpus=$((`grep -c '^processor :' /proc/cpuinfo`+0))
343 if [ $ncpus -gt 1 ]; then
348 enter "$d0/fteqcc" verbose
349 verbose make $MAKEFLAGS
350 enter "$d0/data/xonotic-data.pk3dir" verbose
351 verbose make FTEQCC="$d0/fteqcc/fteqcc.bin" $MAKEFLAGS
352 enter "$d0/darkplaces" verbose
353 verbose make $MAKEFLAGS sv-debug
354 verbose make $MAKEFLAGS cl-debug
355 if ! [ -n "$WE_HATE_OUR_USERS" ]; then
356 verbose make $MAKEFLAGS sdl-debug
360 if [ -n "$WE_HATE_OUR_USERS" ]; then
366 sdl|glx|agl|dedicated)
375 if ! [ -x "darkplaces/darkplaces$client" ]; then
376 if [ -x "darkplaces/darkplaces$client.exe" ]; then
379 echo "Client darkplaces/darkplaces$client not found, aborting"
383 #verbose "darkplaces/darkplaces$client" -xonotic "$@"
384 verbose "darkplaces/darkplaces$client" -nexuiz -customgamename Xonotic -customgamedirname1 data -customgamedirname2 "" -customgamescreenshotname xonotic -customgameuserdirname xonotic "$@"
388 enter "$d0/$d" verbose
395 patchdir=`mktemp -d -t save-patches.XXXXXX`
397 enter "$d0/$d" verbose
398 git branch -v -v | cut -c 3- | {
400 while read -r BRANCH REV UPSTREAM TEXT; do
403 UPSTREAM=${UPSTREAM#\[}
404 UPSTREAM=${UPSTREAM%\]}
405 UPSTREAM=${UPSTREAM%:*}
409 UPSTREAM=origin/master
413 if [ x"$REV" = x"->" ]; then
416 if git format-patch -o "$patchdir/$i" "$UPSTREAM".."$BRANCH"; then
417 echo "$d" > "$patchdir/$i/info.txt"
418 echo "$BRANCH" >> "$patchdir/$i/info.txt"
419 echo "$UPSTREAM" >> "$patchdir/$i/info.txt"
420 echo "$TRACK" >> "$patchdir/$i/info.txt"
423 rm -rf "$patchdir/$i"
428 ( cd "$patchdir" && tar cvzf - . ) > "$outfile"
433 patchdir=`mktemp -d -t restore-patches.XXXXXX`
434 ( cd "$patchdir" && tar xvzf - ) < "$infile"
436 for P in "$patchdir"/*/info.txt; do
443 verbose git checkout HEAD^0
444 verbose git branch -D "$BRANCH"
445 if [ x"$TRACK" = x"true" ]; then
446 verbose git checkout --track -b "$BRANCH" "$UPSTREAM"
448 verbose git branch -b "$BRANCH" "$UPSTREAM"
456 enter "$d0/$d" verbose
457 git rev-parse "$1/$2" || continue
460 git log HEAD.."$1/$2"
461 git diff HEAD..."$1/$2"
464 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
465 echo "Merge \"$1/$2\" into `git symbolic-ref HEAD` of $d?"
468 if [ x"$a" = x"y" ]; then
472 if ! "$SELF" compile; then
476 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
477 echo "Still merge \"$1/$2\" into `git symbolic-ref HEAD` of $d? Maybe you want to test first."
480 if [ x"$a" = x"y" ]; then
484 git reset --hard HEAD@{1}
493 echo " $SELF push [-s]"
494 echo " $SELF branches"
495 echo " $SELF branch [<remote>] <branchname>"
496 echo " $SELF branch <remote> <branchname> <srcbranchname>"
497 echo " $SELF checkout [<remote>] <branchname>"
498 echo " $SELF compile"
499 echo " $SELF run <client> <options>"
500 echo " $SELF each <command>"