Raw
1 #!/bin/sh
2
3 : ${sites:="github2 ko repo"}
4 : ${nexts:="$sites"}
5 : ${mirrors:="github gob-private"}
6
7 push_retry () {
8 sites=$1
9 shift
10 while :
11 do
12 failed=
13 for remote in $sites
14 do
15 printf "%s: " "$remote"
16 git push --follow-tags "$remote" "$@" || failed="$failed$remote "
17 done
18
19 if test -z "$failed"
20 then
21 break
22 elif test "x$sites" = "x$failed"
23 then
24 echo >&2 "Failed to push to: $sites"
25 exit 1
26 fi
27 sites="$failed"
28 done
29 }
30
31 case " $* " in
32 *' +next '* | *' next '*)
33 push_retry "$nexts" "$@"
34 exit $?
35 ;;
36 esac
37
38 push_retry "$sites" "$@"
39
40 case "$#,$*" in
41 0,* | 1,-n)
42 for mirror in $mirrors
43 do
44 printf "$mirror mirror: "
45 git push $mirror "$@" || exit $?
46 done
47 for topic in htmldocs manpages
48 do
49 printf "%s: " "$topic"
50 ( cd ../git-$topic.git && git push "$@") || exit
51 done
52 test "$1" = '-n' || ( cd ../git-htmldocs.git && git push gh-pages )
53 ;;
54 esac