]> git.xonotic.org Git - xonotic/xonotic.git/blob - all
add compile to the help text
[xonotic/xonotic.git] / all
1 #!/bin/sh
2
3 set -e
4
5 repos="
6         .
7         data/xonotic-data.pk3dir
8         data/xonotic-maps.pk3dir
9         data/xonotic-music.pk3dir
10         data/xonotic-nexcompat.pk3dir
11         darkplaces
12 "
13
14 if [ "$#" = 0 ]; then
15         set -- help
16 fi
17 cmd=$1
18 shift
19
20 d0=`pwd`
21 case "$cmd" in
22         update|pull)
23                 base=`git config remote.origin.url`
24                 base=${base%xonotic.git}
25                 for d in $repos; do
26                         if [ -d "$d0/$d" ]; then
27                                 cd "$d0/$d"
28                                 case "$d" in
29                                         .)
30                                                 ;;
31                                         *)
32                                                 git config remote.origin.url "$base${d##*/}.git"
33                                                 ;;
34                                 esac
35                                 git pull
36                                 cd "$d0"
37                         else
38                                 git clone "$base${d##*/}.git" "$d0/$d"
39                         fi
40                 done
41                 ;;
42         checkout)
43                 remote=$1
44                 branch=$2
45                 if [ -z "$branch" ]; then
46                         branch=$remote
47                         remote=origin
48                 fi
49                 exists=false
50                 for d in $repos; do
51                         cd "$d0/$d"
52                         if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
53                                 exists=true
54                                 git checkout "$branch"
55                         elif git rev-parse "refs/remotes/$remote/$branch" >/dev/null 2>&1; then
56                                 exists=true
57                                 git checkout --track -b "$branch" "$remote/$branch"
58                         else
59                                 git checkout master
60                         fi
61                         cd "$d0"
62                 done
63                 "$0" branch
64                 ;;
65         branch)
66                 remote=$1
67                 branch=$2
68                 if [ -z "$branch" ]; then
69                         branch=$remote
70                         remote=origin
71                 fi
72                 if [ -z "$branch" ]; then
73                         for d in $repos; do
74                                 cd "$d0/$d"
75                                 r=`git symbolic-ref HEAD`
76                                 r=${r#refs/heads/}
77                                 echo "$d is at $r"
78                                 cd "$d0"
79                         done
80                 else
81                         for d in $repos; do
82                                 cd "$d0/$d"
83                                 a=
84                                 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
85                                         echo "Branch in $d?"
86                                         read -r a
87                                 done
88                                 if [ x"$a" = x"y" ]; then
89                                         git push "$remote" HEAD:"$branch"
90                                         git checkout --track -b "$branch" "$remote/$branch"
91                                 fi
92                                 cd "$d0"
93                         done
94                         "$0" branch
95                 fi
96                 ;;
97         branches)
98                 for d in $repos; do
99                         cd "$d0/$d"
100                         echo "In $d:"
101                         git branch -a | sed 's/^/  /; /->/d'
102                         cd "$d0"
103                 done
104                 ;;
105         push)
106                 for d in $repos; do
107                         cd "$d0/$d"
108                         r=`git symbolic-ref HEAD`
109                         r=${r#refs/heads/}
110                         a=
111                         if git log "origin/$r".."$r" | grep .; then
112                                 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
113                                         echo "Push $r in $d?"
114                                         read -r a
115                                 done
116                                 if [ x"$a" = x"y" ]; then
117                                         git push `git config "branch.$r.remote" || echo origin` HEAD
118                                 fi
119                         fi
120                         cd "$d0"
121                 done
122                 ;;
123         compile)
124                 (
125                         cd darkplaces
126                         make nexuiz
127                 )
128                 (
129                         cd data/xonotic-data.pk3dir
130                         make
131                 )
132                 ;;
133         *)
134                 echo "Usage:"
135                 echo "  $0 pull"
136                 echo "  $0 push"
137                 echo "  $0 branches"
138                 echo "  $0 branch"
139                 echo "  $0 checkout"
140                 echo "  $0 compile"
141                 ;;
142 esac