]> git.xonotic.org Git - xonotic/xonotic.git/blob - all
make the help screen work
[xonotic/xonotic.git] / all
1 #!/bin/sh
2
3 set -e
4
5 repos="
6         data/xonotic-data.pk3dir
7         data/xonotic-maps.pk3dir
8         data/xonotic-music.pk3dir
9         darkplaces
10 "
11
12 if [ "$#" = 0 ]; then
13         set -- help
14 fi
15 cmd=$1
16 shift
17
18 d0=`pwd`
19 case "$cmd" in
20         update)
21                 base=`git config remote.origin.url`
22                 base=${base%/xonotic.git}
23                 for d in $repos; do
24                         if [ -d "$d0/$d" ]; then
25                                 cd "$d0/$d"
26                                 git config remote.origin.url "$base/${d##*/}.git"
27                                 git pull
28                                 cd "$d0"
29                         else
30                                 git clone "$base/${d##*/}.git" "$d0/$d"
31                         fi
32                 done
33                 ;;
34         checkout)
35                 remote=$1
36                 branch=$2
37                 if [ -z "$branch" ]; then
38                         branch=$remote
39                         remote=origin
40                 fi
41                 exists=false
42                 for d in $repos; do
43                         cd "$d0/$d"
44                         if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
45                                 exists=true
46                                 git checkout "$branch"
47                         elif git rev-parse "refs/remotes/$remote/$branch" >/dev/null 2>&1; then
48                                 exists=true
49                                 git checkout --track -b "$branch" "$remote/$branch"
50                         else
51                                 git checkout master
52                         fi
53                         cd "$d0"
54                 done
55                 "$0" branch
56                 ;;
57         branch)
58                 for d in $repos; do
59                         cd "$d0/$d"
60                         r=`git symbolic-ref HEAD`
61                         r=${r#refs/heads/}
62                         echo "$d is at $r"
63                         cd "$d0"
64                 done
65                 ;;
66         branches)
67                 for d in $repos; do
68                         cd "$d0/$d"
69                         echo "In $d:"
70                         git branch -a | sed 's/^/  /'
71                         cd "$d0"
72                 done
73                 ;;
74         *)
75                 echo "Usage:"
76                 echo "  $0 update"
77                 echo "  $0 branch"
78                 echo "  $0 branches"
79                 echo "  $0 checkout"
80                 ;;
81 esac