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"
169 echo "Pulling failed. Press ENTER to continue, or Ctrl-C to abort."
175 checkself "$cmd" "$@"
177 verbose git remote prune origin
180 verbose git clone "$url" "$d0/$d"
187 if [ -z "$branch" ]; then
193 enter "$d0/$d" verbose
194 if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
196 verbose git checkout "$branch"
197 elif git rev-parse "refs/remotes/$remote/$branch" >/dev/null 2>&1; then
199 verbose git checkout --track -b "$branch" "$remote/$branch"
201 verbose git checkout master
204 checkself "$cmd" "$@"
208 echo "The requested branch was not found in any repository."
216 if [ -z "$branch" ]; then
220 if [ -z "$srcbranch" ]; then
223 if [ -z "$branch" ]; then
226 r=`git symbolic-ref HEAD`
233 dv=`visible_repo_name "$d"`
234 enter "$d0/$d" verbose
236 if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
237 echo "Already having this branch in $dv."
239 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
240 echo "Branch in $dv?"
243 if [ x"$a" = x"y" ]; then
244 verbose git push "$remote" "$srcbranch":"$branch"
245 verbose git checkout --track -b "$branch" "$remote/$branch"
257 git branch -a -v -v | cut -c 3- | while read -r BRANCH REV UPSTREAM TEXT; do
260 UPSTREAM=${UPSTREAM#\[}
261 UPSTREAM=${UPSTREAM%\]}
262 UPSTREAM=${UPSTREAM%:*}
265 TEXT="$UPSTREAM $TEXT"
269 if [ x"$REV" = x"->" ]; then
272 BRANCH=${BRANCH#remotes/}
274 if [ -n "$UPSTREAM" ]; then
275 echo -n " (tracking $UPSTREAM)"
284 dv=`visible_repo_name "$d"`
285 enter "$d0/$d" verbose
286 r=`git symbolic-ref HEAD`
288 if git log HEAD..origin/master | grep .; then
289 # we have uncommitted changes
291 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
292 echo "Could merge from \"master\" into \"$r\" in $dv. Do it?"
295 if [ x"$a" = x"y" ]; then
296 if ! verbose git merge origin/master; then
297 check_mergeconflict "$d"
298 exit 1 # this should ALWAYS be fatal
308 dv=`visible_repo_name "$d"`
309 enter "$d0/$d" verbose
310 r=`git symbolic-ref HEAD`
312 if git diff HEAD | grep .; then
313 # we have uncommitted changes
315 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
316 echo "Uncommitted changes in \"$r\" in $dv. Commit?"
319 if [ x"$a" = x"y" ]; then
320 verbose git commit -a
323 rem=`git config "branch.$r.remote" || echo origin`
324 if git log "$rem/$r".."$r" | grep .; then
326 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
327 echo "Push \"$r\" in $dv?"
330 if [ x"$a" = x"y" ]; then
331 verbose git push "$rem" HEAD
334 if [ x"$submit" = x"-s" ]; then
337 verbose git push "$rem" HEAD:"${r%%/*}/finished/${r#*/}"
345 if [ -z "$MAKEFLAGS" ]; then
346 if [ -f /proc/cpuinfo ]; then
347 ncpus=$((`grep -c '^processor :' /proc/cpuinfo`+0))
348 if [ $ncpus -gt 1 ]; then
353 enter "$d0/fteqcc" verbose
354 verbose make $MAKEFLAGS
355 enter "$d0/data/xonotic-data.pk3dir" verbose
356 verbose make FTEQCC="$d0/fteqcc/fteqcc.bin" $MAKEFLAGS
357 enter "$d0/darkplaces" verbose
358 verbose make $MAKEFLAGS sv-debug
359 verbose make $MAKEFLAGS cl-debug
360 if ! [ -n "$WE_HATE_OUR_USERS" ]; then
361 verbose make $MAKEFLAGS sdl-debug
365 if [ -n "$WE_HATE_OUR_USERS" ]; then
371 sdl|glx|agl|dedicated)
380 if ! [ -x "darkplaces/darkplaces$client" ]; then
381 if [ -x "darkplaces/darkplaces$client.exe" ]; then
384 echo "Client darkplaces/darkplaces$client not found, aborting"
388 #verbose "darkplaces/darkplaces$client" -xonotic "$@"
389 verbose "darkplaces/darkplaces$client" -nexuiz -customgamename Xonotic -customgamedirname1 data -customgamedirname2 "" -customgamescreenshotname xonotic -customgameuserdirname xonotic "$@"
393 enter "$d0/$d" verbose
400 patchdir=`mktemp -d -t save-patches.XXXXXX`
402 enter "$d0/$d" verbose
403 git branch -v -v | cut -c 3- | {
405 while read -r BRANCH REV UPSTREAM TEXT; do
408 UPSTREAM=${UPSTREAM#\[}
409 UPSTREAM=${UPSTREAM%\]}
410 UPSTREAM=${UPSTREAM%:*}
414 UPSTREAM=origin/master
418 if [ x"$REV" = x"->" ]; then
421 if git format-patch -o "$patchdir/$i" "$UPSTREAM".."$BRANCH"; then
422 echo "$d" > "$patchdir/$i/info.txt"
423 echo "$BRANCH" >> "$patchdir/$i/info.txt"
424 echo "$UPSTREAM" >> "$patchdir/$i/info.txt"
425 echo "$TRACK" >> "$patchdir/$i/info.txt"
428 rm -rf "$patchdir/$i"
433 ( cd "$patchdir" && tar cvzf - . ) > "$outfile"
438 patchdir=`mktemp -d -t restore-patches.XXXXXX`
439 ( cd "$patchdir" && tar xvzf - ) < "$infile"
441 for P in "$patchdir"/*/info.txt; do
448 verbose git checkout HEAD^0
449 verbose git branch -D "$BRANCH"
450 if [ x"$TRACK" = x"true" ]; then
451 verbose git checkout --track -b "$BRANCH" "$UPSTREAM"
453 verbose git branch -b "$BRANCH" "$UPSTREAM"
461 enter "$d0/$d" verbose
462 git rev-parse "$1/$2" || continue
465 git log HEAD.."$1/$2"
466 git diff HEAD..."$1/$2"
469 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
470 echo "Merge \"$1/$2\" into `git symbolic-ref HEAD` of $d?"
473 if [ x"$a" = x"y" ]; then
477 if ! "$SELF" compile; then
481 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
482 echo "Still merge \"$1/$2\" into `git symbolic-ref HEAD` of $d? Maybe you want to test first."
485 if [ x"$a" = x"y" ]; then
489 git reset --hard HEAD@{1}
498 echo " $SELF push [-s]"
499 echo " $SELF branches"
500 echo " $SELF branch [<remote>] <branchname>"
501 echo " $SELF branch <remote> <branchname> <srcbranchname>"
502 echo " $SELF checkout [<remote>] <branchname>"
503 echo " $SELF compile"
504 echo " $SELF run <client> <options>"
505 echo " $SELF each <command>"