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