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
123 for X in $repos_urls; do
126 if [ x"$p" = x"$d" ] || [ -d "$d" ] || ! [ -f "$p" ]; then
132 repos=`for X in $repos_urls; do echo "${X%%@*}"; done`
134 if [ "$#" = 0 ]; then
142 base=`git config remote.origin.url`
143 base=${base%xonotic.git}
144 for dcomplete in $repos_urls; do
153 url=$base${d##*/}.git
157 if [ -d "$d0/$d" ]; then
158 enter "$d0/$d" verbose
164 verbose git config remote.origin.url "$url"
168 verbose git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
169 # TODO remove this line later
171 verbose git config core.autocrlf false
172 verbose git config core.safecrlf false # we don't NEED that...
174 r=`git symbolic-ref HEAD`
176 if git config branch.$r.remote >/dev/null 2>&1; then
177 if ! verbose git pull; then
178 check_mergeconflict "$d"
179 echo "Pulling failed. Press ENTER to continue, or Ctrl-C to abort."
185 checkself "$cmd" "$@"
187 verbose git remote prune origin
190 verbose git clone "$url" "$d0/$d"
197 if [ -z "$branch" ]; then
203 enter "$d0/$d" verbose
204 if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
206 verbose git checkout "$branch"
207 elif git rev-parse "refs/remotes/$remote/$branch" >/dev/null 2>&1; then
209 verbose git checkout --track -b "$branch" "$remote/$branch"
211 verbose git checkout master
214 checkself "$cmd" "$@"
218 echo "The requested branch was not found in any repository."
226 if [ -z "$branch" ]; then
230 if [ -z "$srcbranch" ]; then
233 if [ -z "$branch" ]; then
236 r=`git symbolic-ref HEAD`
243 dv=`visible_repo_name "$d"`
244 enter "$d0/$d" verbose
246 if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
247 echo "Already having this branch in $dv."
249 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
250 echo "Branch in $dv?"
253 if [ x"$a" = x"y" ]; then
254 verbose git push "$remote" "$srcbranch":"$branch"
255 verbose git checkout --track -b "$branch" "$remote/$branch"
267 git branch -a -v -v | cut -c 3- | while read -r BRANCH REV UPSTREAM TEXT; do
270 UPSTREAM=${UPSTREAM#\[}
271 UPSTREAM=${UPSTREAM%\]}
272 UPSTREAM=${UPSTREAM%:*}
275 TEXT="$UPSTREAM $TEXT"
279 if [ x"$REV" = x"->" ]; then
282 BRANCH=${BRANCH#remotes/}
284 if [ -n "$UPSTREAM" ]; then
285 echo -n " (tracking $UPSTREAM)"
294 dv=`visible_repo_name "$d"`
295 enter "$d0/$d" verbose
296 r=`git symbolic-ref HEAD`
298 if git log HEAD..origin/master | grep .; then
299 # we have uncommitted changes
301 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
302 echo "Could merge from \"master\" into \"$r\" in $dv. Do it?"
305 if [ x"$a" = x"y" ]; then
306 if ! verbose git merge origin/master; then
307 check_mergeconflict "$d"
308 exit 1 # this should ALWAYS be fatal
318 dv=`visible_repo_name "$d"`
319 enter "$d0/$d" verbose
320 r=`git symbolic-ref HEAD`
322 if git diff HEAD | grep .; then
323 # we have uncommitted changes
325 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
326 echo "Uncommitted changes in \"$r\" in $dv. Commit?"
329 if [ x"$a" = x"y" ]; then
330 verbose git commit -a
333 rem=`git config "branch.$r.remote" || echo origin`
334 if git log "$rem/$r".."$r" | grep .; then
336 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
337 echo "Push \"$r\" in $dv?"
340 if [ x"$a" = x"y" ]; then
341 verbose git push "$rem" HEAD
344 if [ x"$submit" = x"-s" ]; then
347 verbose git push "$rem" HEAD:"${r%%/*}/finished/${r#*/}"
355 if [ -z "$MAKEFLAGS" ]; then
356 if [ -f /proc/cpuinfo ]; then
357 ncpus=$((`grep -c '^processor :' /proc/cpuinfo`+0))
358 if [ $ncpus -gt 1 ]; then
363 enter "$d0/fteqcc" verbose
364 verbose make $MAKEFLAGS
365 enter "$d0/data/xonotic-data.pk3dir" verbose
366 verbose make FTEQCC="$d0/fteqcc/fteqcc.bin" $MAKEFLAGS
367 enter "$d0/darkplaces" verbose
368 verbose make $MAKEFLAGS sv-debug
369 verbose make $MAKEFLAGS cl-debug
370 if ! [ -n "$WE_HATE_OUR_USERS" ]; then
371 verbose make $MAKEFLAGS sdl-debug
375 if [ -n "$WE_HATE_OUR_USERS" ]; then
381 sdl|glx|agl|dedicated)
390 if ! [ -x "darkplaces/darkplaces$client" ]; then
391 if [ -x "darkplaces/darkplaces$client.exe" ]; then
394 echo "Client darkplaces/darkplaces$client not found, aborting"
398 #verbose "darkplaces/darkplaces$client" -xonotic "$@"
399 verbose "darkplaces/darkplaces$client" -nexuiz -customgamename Xonotic -customgamedirname1 data -customgamedirname2 "" -customgamescreenshotname xonotic -customgameuserdirname xonotic "$@"
403 enter "$d0/$d" verbose
410 patchdir=`mktemp -d -t save-patches.XXXXXX`
412 enter "$d0/$d" verbose
413 git branch -v -v | cut -c 3- | {
415 while read -r BRANCH REV UPSTREAM TEXT; do
418 UPSTREAM=${UPSTREAM#\[}
419 UPSTREAM=${UPSTREAM%\]}
420 UPSTREAM=${UPSTREAM%:*}
424 UPSTREAM=origin/master
428 if [ x"$REV" = x"->" ]; then
431 if git format-patch -o "$patchdir/$i" "$UPSTREAM".."$BRANCH"; then
432 echo "$d" > "$patchdir/$i/info.txt"
433 echo "$BRANCH" >> "$patchdir/$i/info.txt"
434 echo "$UPSTREAM" >> "$patchdir/$i/info.txt"
435 echo "$TRACK" >> "$patchdir/$i/info.txt"
438 rm -rf "$patchdir/$i"
443 ( cd "$patchdir" && tar cvzf - . ) > "$outfile"
448 patchdir=`mktemp -d -t restore-patches.XXXXXX`
449 ( cd "$patchdir" && tar xvzf - ) < "$infile"
451 for P in "$patchdir"/*/info.txt; do
458 verbose git checkout HEAD^0
459 verbose git branch -D "$BRANCH"
460 if [ x"$TRACK" = x"true" ]; then
461 verbose git checkout --track -b "$BRANCH" "$UPSTREAM"
463 verbose git branch -b "$BRANCH" "$UPSTREAM"
471 enter "$d0/$d" verbose
472 git rev-parse "$1/$2" || continue
475 git log HEAD.."$1/$2"
476 git diff HEAD..."$1/$2"
479 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
480 echo "Merge \"$1/$2\" into `git symbolic-ref HEAD` of $d?"
483 if [ x"$a" = x"y" ]; then
487 if ! "$SELF" compile; then
491 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
492 echo "Still merge \"$1/$2\" into `git symbolic-ref HEAD` of $d? Maybe you want to test first."
495 if [ x"$a" = x"y" ]; then
499 git reset --hard HEAD@{1}
508 echo " $SELF push [-s]"
509 echo " $SELF branches"
510 echo " $SELF branch [<remote>] <branchname>"
511 echo " $SELF branch <remote> <branchname> <srcbranchname>"
512 echo " $SELF checkout [<remote>] <branchname>"
513 echo " $SELF compile"
514 echo " $SELF run <client> <options>"
515 echo " $SELF each <command>"