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/*"
157 # TODO remove this line later
159 git config core.autocrlf input
160 git config core.safecrlf true
162 r=`git symbolic-ref HEAD`
164 if git config branch.$r.remote >/dev/null 2>&1; then
165 if ! verbose git pull; then
166 check_mergeconflict "$d"
172 checkself "$cmd" "$@"
174 verbose git remote prune origin
177 verbose git clone "$url" "$d0/$d"
184 if [ -z "$branch" ]; then
190 enter "$d0/$d" verbose
191 if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
193 verbose git checkout "$branch"
194 elif git rev-parse "refs/remotes/$remote/$branch" >/dev/null 2>&1; then
196 verbose git checkout --track -b "$branch" "$remote/$branch"
198 verbose git checkout master
201 checkself "$cmd" "$@"
205 echo "The requested branch was not found in any repository."
213 if [ -z "$branch" ]; then
217 if [ -z "$srcbranch" ]; then
220 if [ -z "$branch" ]; then
223 r=`git symbolic-ref HEAD`
230 dv=`visible_repo_name "$d"`
231 enter "$d0/$d" verbose
233 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
234 echo "Branch in $dv?"
237 if [ x"$a" = x"y" ]; then
238 verbose git push "$remote" "$srcbranch":"$branch"
239 verbose git checkout --track -b "$branch" "$remote/$branch"
250 git branch -a -v -v | cut -c 3- | while read -r BRANCH REV UPSTREAM TEXT; do
253 UPSTREAM=${UPSTREAM#\[}
254 UPSTREAM=${UPSTREAM%\]}
255 UPSTREAM=${UPSTREAM%:*}
258 TEXT="$UPSTREAM $TEXT"
262 if [ x"$REV" = x"->" ]; then
265 BRANCH=${BRANCH#remotes/}
267 if [ -n "$UPSTREAM" ]; then
268 echo -n " (tracking $UPSTREAM)"
277 dv=`visible_repo_name "$d"`
278 enter "$d0/$d" verbose
279 r=`git symbolic-ref HEAD`
281 if git log HEAD..origin/master | grep .; then
282 # we have uncommitted changes
284 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
285 echo "Could merge from \"master\" into \"$r\" in $dv. Do it?"
288 if [ x"$a" = x"y" ]; then
289 if ! verbose git merge origin/master; then
290 check_mergeconflict "$d"
291 exit 1 # this should ALWAYS be fatal
300 dv=`visible_repo_name "$d"`
301 enter "$d0/$d" verbose
302 r=`git symbolic-ref HEAD`
304 if git diff HEAD | grep .; then
305 # we have uncommitted changes
307 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
308 echo "Uncommitted changes in \"$r\" in $dv. Commit?"
311 if [ x"$a" = x"y" ]; then
312 verbose git commit -a
315 rem=`git config "branch.$r.remote" || echo origin`
316 if git log "$rem/$r".."$r" | grep .; then
318 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
319 echo "Push \"$r\" in $dv?"
322 if [ x"$a" = x"y" ]; then
323 verbose git push "$rem" HEAD
330 if [ -z "$MAKEFLAGS" ]; then
331 if [ -f /proc/cpuinfo ]; then
332 ncpus=$((`grep -c '^processor :' /proc/cpuinfo`+0))
333 if [ $ncpus -gt 1 ]; then
338 enter "$d0/fteqcc" verbose
339 verbose make $MAKEFLAGS
340 enter "$d0/data/xonotic-data.pk3dir" verbose
341 verbose make FTEQCC="$d0/fteqcc/fteqcc.bin" $MAKEFLAGS
342 enter "$d0/darkplaces" verbose
343 verbose make $MAKEFLAGS sv-debug
344 verbose make $MAKEFLAGS cl-debug
345 verbose make $MAKEFLAGS sdl-debug
350 sdl|glx|agl|dedicated)
359 if ! [ -x "darkplaces/darkplaces$client" ]; then
360 if [ -x "darkplaces/darkplaces$client.exe" ]; then
363 echo "Client darkplaces/darkplaces$client not found, aborting"
367 #verbose "darkplaces/darkplaces$client" -xonotic "$@"
368 verbose "darkplaces/darkplaces$client" -nexuiz -customgamename Xonotic -customgamedirname1 data -customgamedirname2 "" -customgamescreenshotname xonotic -customgameuserdirname xonotic "$@"
372 enter "$d0/$d" verbose
379 patchdir=`mktemp -d -t save-patches.XXXXXX`
381 enter "$d0/$d" verbose
382 git branch -v -v | cut -c 3- | {
384 while read -r BRANCH REV UPSTREAM TEXT; do
387 UPSTREAM=${UPSTREAM#\[}
388 UPSTREAM=${UPSTREAM%\]}
389 UPSTREAM=${UPSTREAM%:*}
393 UPSTREAM=origin/master
397 if [ x"$REV" = x"->" ]; then
400 if git format-patch -o "$patchdir/$i" "$UPSTREAM".."$BRANCH"; then
401 echo "$d" > "$patchdir/$i/info.txt"
402 echo "$BRANCH" >> "$patchdir/$i/info.txt"
403 echo "$UPSTREAM" >> "$patchdir/$i/info.txt"
404 echo "$TRACK" >> "$patchdir/$i/info.txt"
407 rm -rf "$patchdir/$i"
412 ( cd "$patchdir" && tar cvzf - . ) > "$outfile"
417 patchdir=`mktemp -d -t restore-patches.XXXXXX`
418 ( cd "$patchdir" && tar xvzf - ) < "$infile"
420 for P in "$patchdir"/*/info.txt; do
427 verbose git checkout HEAD^0
428 verbose git branch -D "$BRANCH"
429 if [ x"$TRACK" = x"true" ]; then
430 verbose git checkout --track -b "$BRANCH" "$UPSTREAM"
432 verbose git branch -b "$BRANCH" "$UPSTREAM"
443 echo " $SELF branches"
444 echo " $SELF branch [<remote>] <branchname>"
445 echo " $SELF branch <remote> <branchname> <srcbranchname>"
446 echo " $SELF checkout [<remote>] <branchname>"
447 echo " $SELF compile"
448 echo " $SELF run <client> <options>"
449 echo " $SELF each <command>"