aboutsummaryrefslogtreecommitdiffstats
path: root/pushall
blob: 8d18760b007998a6037ccc76e7d12a2a1a789fa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh

#sites='ko repo github2 sfjp sf.net'

: ${sites:="github2 ko repo"}
: ${nexts:="$sites"}
: ${mirrors="github gob-private"}

push_retry () {
	sites=$1
	shift
	while :
	do
		failed=
		for remote in $sites
		do
			printf "%s: " "$remote"
			git push --follow-tags "$remote" "$@" || failed="$failed$remote "
		done

		if test -z "$failed"
		then
			break
		elif test "x$sites" = "x$failed"
		then
			echo >&2 "Failed to push to: $sites"
			exit 1
		fi
		sites="$failed"
	done
}

case " $* " in
*' +next '* | *' next '*)
	push_retry "$nexts" "$@"
	exit $?
	;;
esac

push_retry "$sites" "$@"

case "$#,$*" in
0,* | 1,-n)
	for mirror in $mirrors
	do
		printf "$mirror mirror: "
		git push $mirror "$@" || exit $?
	done
	for topic in htmldocs manpages
	do
		printf "%s: " "$topic"
		( cd ../git-$topic.git && git push "$@") || exit
	done
	test "$1" = '-n' || ( cd ../git-htmldocs.git && git push gh-pages )
	;;
esac