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 exec ../all.xonotic.sh "$@"
39 if [ -x /usr/bin/md5sum ]; then
41 elif [ -x /bin/md5sum ]; then
43 elif [ -x /usr/bin/cksum ]; then
50 self=`checksum "$SELF"`
53 self_new=`checksum "$SELF"`
54 if [ x"$self" != x"$self_new" ]; then
55 msg "./all has changed."
56 if [ -z "$XONOTIC_FORBID_RERUN_ALL" ]; then
57 msg "Rerunning the requested operation to make sure."
58 export XONOTIC_FORBID_RERUN_ALL=1
61 msg "Please try $SELF update, and then retry your requested operation."
78 echo "the root directory"
88 if git ls-files -u | grep ' 1 '; then
90 echo "MERGE CONFLICT."
91 echo "change into the \"$1\" project directory, and then:"
92 echo "- edit the files mentioned above with your favorite editor,"
93 echo " and fix the conflicts (marked with <<<<<<< blocks)"
94 echo "- for binary files, you can select the files using"
95 echo " git checkout --ours or git checkout --theirs"
96 echo "- when done with a file, 'git add' the file"
97 echo "- when done, 'git commit'"
106 check_mergeconflict "$1"
111 data/xonotic-data.pk3dir
112 data/xonotic-maps.pk3dir
113 data/xonotic-music.pk3dir
114 data/xonotic-nexcompat.pk3dir
116 fteqcc@git://github.com/Blub/qclib.git
117 div0-gittools@git://git.icculus.org/divverent/div0-gittools.git
121 repos=`for X in $repos_urls; do echo "${X%%@*}"; done`
123 if [ "$#" = 0 ]; then
131 base=`git config remote.origin.url`
132 base=${base%xonotic.git}
133 for dcomplete in $repos_urls; do
142 url=$base${d##*/}.git
146 if [ -d "$d0/$d" ]; then
147 enter "$d0/$d" verbose
153 verbose git config remote.origin.url "$url"
157 verbose git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
158 # TODO remove this line later
160 verbose git config core.autocrlf input
161 verbose git config core.safecrlf true
163 r=`git symbolic-ref HEAD`
165 if git config branch.$r.remote >/dev/null 2>&1; then
166 if ! verbose git pull; then
167 check_mergeconflict "$d"
173 checkself "$cmd" "$@"
175 verbose git remote prune origin
178 verbose git clone "$url" "$d0/$d"
185 if [ -z "$branch" ]; then
191 enter "$d0/$d" verbose
192 if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
194 verbose git checkout "$branch"
195 elif git rev-parse "refs/remotes/$remote/$branch" >/dev/null 2>&1; then
197 verbose git checkout --track -b "$branch" "$remote/$branch"
199 verbose git checkout master
202 checkself "$cmd" "$@"
206 echo "The requested branch was not found in any repository."
214 if [ -z "$branch" ]; then
218 if [ -z "$srcbranch" ]; then
221 if [ -z "$branch" ]; then
224 r=`git symbolic-ref HEAD`
231 dv=`visible_repo_name "$d"`
232 enter "$d0/$d" verbose
234 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
235 echo "Branch in $dv?"
238 if [ x"$a" = x"y" ]; then
239 verbose git push "$remote" "$srcbranch":"$branch"
240 verbose git checkout --track -b "$branch" "$remote/$branch"
251 git branch -a -v -v | cut -c 3- | while read -r BRANCH REV UPSTREAM TEXT; do
254 UPSTREAM=${UPSTREAM#\[}
255 UPSTREAM=${UPSTREAM%\]}
256 UPSTREAM=${UPSTREAM%:*}
259 TEXT="$UPSTREAM $TEXT"
263 if [ x"$REV" = x"->" ]; then
266 BRANCH=${BRANCH#remotes/}
268 if [ -n "$UPSTREAM" ]; then
269 echo -n " (tracking $UPSTREAM)"
278 dv=`visible_repo_name "$d"`
279 enter "$d0/$d" verbose
280 r=`git symbolic-ref HEAD`
282 if git log HEAD..origin/master | grep .; then
283 # we have uncommitted changes
285 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
286 echo "Could merge from \"master\" into \"$r\" in $dv. Do it?"
289 if [ x"$a" = x"y" ]; then
290 if ! verbose git merge origin/master; then
291 check_mergeconflict "$d"
292 exit 1 # this should ALWAYS be fatal
302 dv=`visible_repo_name "$d"`
303 enter "$d0/$d" verbose
304 r=`git symbolic-ref HEAD`
306 if git diff HEAD | grep .; then
307 # we have uncommitted changes
309 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
310 echo "Uncommitted changes in \"$r\" in $dv. Commit?"
313 if [ x"$a" = x"y" ]; then
314 verbose git commit -a
317 rem=`git config "branch.$r.remote" || echo origin`
318 if git log "$rem/$r".."$r" | grep .; then
320 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
321 echo "Push \"$r\" in $dv?"
324 if [ x"$a" = x"y" ]; then
325 verbose git push "$rem" HEAD
328 if [ x"$submit" = x"-s" ]; then
331 verbose git push "$rem" HEAD:"${r%%/*}/finished/${r#*/}"
339 if [ -z "$MAKEFLAGS" ]; then
340 if [ -f /proc/cpuinfo ]; then
341 ncpus=$((`grep -c '^processor :' /proc/cpuinfo`+0))
342 if [ $ncpus -gt 1 ]; then
347 enter "$d0/fteqcc" verbose
348 verbose make $MAKEFLAGS
349 enter "$d0/data/xonotic-data.pk3dir" verbose
350 verbose make FTEQCC="$d0/fteqcc/fteqcc.bin" $MAKEFLAGS
351 enter "$d0/darkplaces" verbose
352 verbose make $MAKEFLAGS sv-debug
353 verbose make $MAKEFLAGS cl-debug
354 verbose make $MAKEFLAGS sdl-debug
359 sdl|glx|agl|dedicated)
368 if ! [ -x "darkplaces/darkplaces$client" ]; then
369 if [ -x "darkplaces/darkplaces$client.exe" ]; then
372 echo "Client darkplaces/darkplaces$client not found, aborting"
376 #verbose "darkplaces/darkplaces$client" -xonotic "$@"
377 verbose "darkplaces/darkplaces$client" -nexuiz -customgamename Xonotic -customgamedirname1 data -customgamedirname2 "" -customgamescreenshotname xonotic -customgameuserdirname xonotic "$@"
381 enter "$d0/$d" verbose
388 patchdir=`mktemp -d -t save-patches.XXXXXX`
390 enter "$d0/$d" verbose
391 git branch -v -v | cut -c 3- | {
393 while read -r BRANCH REV UPSTREAM TEXT; do
396 UPSTREAM=${UPSTREAM#\[}
397 UPSTREAM=${UPSTREAM%\]}
398 UPSTREAM=${UPSTREAM%:*}
402 UPSTREAM=origin/master
406 if [ x"$REV" = x"->" ]; then
409 if git format-patch -o "$patchdir/$i" "$UPSTREAM".."$BRANCH"; then
410 echo "$d" > "$patchdir/$i/info.txt"
411 echo "$BRANCH" >> "$patchdir/$i/info.txt"
412 echo "$UPSTREAM" >> "$patchdir/$i/info.txt"
413 echo "$TRACK" >> "$patchdir/$i/info.txt"
416 rm -rf "$patchdir/$i"
421 ( cd "$patchdir" && tar cvzf - . ) > "$outfile"
426 patchdir=`mktemp -d -t restore-patches.XXXXXX`
427 ( cd "$patchdir" && tar xvzf - ) < "$infile"
429 for P in "$patchdir"/*/info.txt; do
436 verbose git checkout HEAD^0
437 verbose git branch -D "$BRANCH"
438 if [ x"$TRACK" = x"true" ]; then
439 verbose git checkout --track -b "$BRANCH" "$UPSTREAM"
441 verbose git branch -b "$BRANCH" "$UPSTREAM"
449 enter "$d0/$d" verbose
450 git rev-parse "$1/$2" || continue
453 git log HEAD.."$1/$2"
454 git diff HEAD..."$1/$2"
457 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
458 echo "Merge \"$1/$2\" into `git symbolic-ref HEAD` of $d?"
461 if [ x"$a" = x"y" ]; then
465 if ! "$SELF" compile; then
469 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
470 echo "Still merge \"$1/$2\" into `git symbolic-ref HEAD` of $d? Maybe you want to test first."
473 if [ x"$a" = x"y" ]; then
477 git reset --hard HEAD@{1}
486 echo " $SELF push [-s]"
487 echo " $SELF branches"
488 echo " $SELF branch [<remote>] <branchname>"
489 echo " $SELF branch <remote> <branchname> <srcbranchname>"
490 echo " $SELF checkout [<remote>] <branchname>"
491 echo " $SELF compile"
492 echo " $SELF run <client> <options>"
493 echo " $SELF each <command>"