TODO updates
[git] / Doit
1 #!/bin/sh
2
3 : ${J=-j2}
4 force=
5 while   case "$1" in
6         -pedantic) M=$1 ;;
7         -force) force=$1 ;;
8         *) break ;;
9         esac
10 do
11         shift
12 done
13
14 test -z "$(git diff --cached --name-status)" || {
15         echo >&2 "Repository unclean."
16         exit 1
17 }
18 Meta/Make clean >/dev/null 2>&1
19
20 : ${branches='next master maint pu'}
21
22 for branch in $branches
23 do
24         echo >&3 "** $branch **"
25
26         revision=$(git show-ref -s --verify "refs/heads/$branch") || {
27                 echo "** No $branch"
28                 continue
29         }
30
31         if      installed=$($HOME/git-$branch/bin/git version) &&
32                 {
33                         version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$') ||
34                         version=v$(expr "$installed" : 'git version \(.*\)')
35                 } &&
36                 version=$(git rev-parse --verify "$version^0" 2>/dev/null) &&
37                 test "z$version" = "z$revision"
38         then
39                 echo "* up-to-date version \"$installed\" is already installed from $branch"
40                 test -n "$force" || continue
41         fi
42
43         echo "** $branch" &&
44         git checkout $branch &&
45         Meta/Make $M -- $J all &&
46         Meta/Make $M -- test &&
47         Meta/Make $M -- install &&
48         Meta/Make clean || exit $?
49
50 done >./:all.log 3>&2 2>&1
51
52 git checkout master
53
54