What's cooking
[git/dscho.git] / Doit
blob1d4c4d64ad7643e5dd4498ce089638866c249d58
1 #!/bin/sh
3 : ${J=-j4}
4 force=
5 while case "$1" in
6 -pedantic) M=$1 ;;
7 -force) force=$1 ;;
8 -dash) with_dash=y ;;
9 -noinstall) install=noinstall ;;
10 *) break ;;
11 esac
13 shift
14 done
16 test -z "$(git diff --cached --name-status)" || {
17 echo >&2 "Repository unclean."
18 exit 1
20 Meta/Make clean >/dev/null 2>&1
22 test -f /bin/dash || with_dash=
24 : ${branches='next master maint pu jch'}
26 for branch in $branches
28 echo >&3 "** $branch **"
30 revision=$(git show-ref -s --verify "refs/heads/$branch") || {
31 echo "** No $branch"
32 continue
35 private=$(git rev-parse -q --verify private-$branch 2>/dev/null)
36 case $? in 0|1) ;; *) exit $? ;; esac
38 if installed=$($HOME/git-$branch/bin/git version) &&
39 if version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$')
40 then
42 elif version=v$(expr "$installed" : \
43 'git version \(.*\)\.rc[0-9]*$')
44 then
45 version="$version"-$(expr "$installed" : \
46 'git version .*\.\(rc[0-9]*\)$')
47 else
48 version=v$(expr "$installed" : 'git version \(.*\)')
49 fi &&
50 version=$(git rev-parse --verify "$version^0" 2>/dev/null) &&
51 test "z$version" = "z$revision"
52 then
53 echo "* up-to-date version \"$installed\" is already installed from $branch"
54 test -n "$force" || continue
57 echo "** $branch" &&
58 git checkout $branch &&
60 case "$private" in
61 '')
63 ?*)
64 git merge --squash --no-commit "$private" || {
65 echo >&2 "Cannot apply private edition changes"
66 git reset --hard
69 esac &&
71 Meta/Make $M -- $J clean &&
72 case "$with_dash" in
74 case "$branch" in
75 master | maint | next | jch)
76 Meta/Make $M -- $J SHELL_PATH=/bin/dash test &&
77 Meta/Make $M -- $J clean
79 esac
81 esac &&
83 Meta/Make $M -- $J all &&
84 Meta/Make $M -- $J test &&
85 case "$branch" in
86 master | maint | next )
87 Meta/Make $M -- doc
89 jch )
90 Meta/Make $M -- doc install-doc
93 : ;;
94 esac &&
96 test z$install = znoinstall ||
97 Meta/Make $M -- install
98 } &&
99 Meta/Make clean || exit $?
101 git reset --hard
103 done >./:all.log 3>&2 2>&1
105 git checkout master