V: pay attention to dirty versions
[git/spearce.git] / Doit
blob74051e02d7ae13160aedfd4743891f4ecab8f8c0
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 *) break ;;
10 esac
12 shift
13 done
15 test -z "$(git diff --cached --name-status)" || {
16 echo >&2 "Repository unclean."
17 exit 1
19 Meta/Make clean >/dev/null 2>&1
21 test -f /bin/dash || with_dash=
23 : ${branches='next master maint pu jch'}
25 for branch in $branches
27 echo >&3 "** $branch **"
29 revision=$(git show-ref -s --verify "refs/heads/$branch") || {
30 echo "** No $branch"
31 continue
34 private=$(git rev-parse -q --verify private-$branch 2>/dev/null)
35 case $? in 0|1) ;; *) exit $? ;; esac
37 if installed=$($HOME/git-$branch/bin/git version) &&
38 if version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$')
39 then
41 elif version=v$(expr "$installed" : \
42 'git version \(.*\)\.rc[0-9]*$')
43 then
44 version="$version"-$(expr "$installed" : \
45 'git version .*\.\(rc[0-9]*\)$')
46 else
47 version=v$(expr "$installed" : 'git version \(.*\)')
48 fi &&
49 version=$(git rev-parse --verify "$version^0" 2>/dev/null) &&
50 test "z$version" = "z$revision"
51 then
52 echo "* up-to-date version \"$installed\" is already installed from $branch"
53 test -n "$force" || continue
56 echo "** $branch" &&
57 git checkout $branch &&
59 case "$private" in
60 '')
62 ?*)
63 git merge --squash --no-commit "$private" || {
64 echo >&2 "Cannot apply private edition changes"
65 git reset --hard
68 esac &&
70 Meta/Make $M -- $J clean &&
71 case "$with_dash" in
73 case "$branch" in
74 master | maint | next | jch)
75 Meta/Make $M -- $J SHELL_PATH=/bin/dash test &&
76 Meta/Make $M -- $J clean
78 esac
80 esac &&
82 Meta/Make $M -- $J all &&
83 Meta/Make $M -- $J test &&
84 case "$branch" in
85 master | maint | next )
86 Meta/Make $M -- doc
88 jch )
89 Meta/Make $M -- doc install-doc
92 : ;;
93 esac &&
94 Meta/Make $M -- install &&
95 Meta/Make clean || exit $?
97 git reset --hard
99 done >./:all.log 3>&2 2>&1
101 git checkout master