Add Dothem script

This keeps the checkout around and performs much better than Doit.

Junio C Hamano committed Mar 5, 2009 at 01:50 UTC 0f6f6ec046a6061e76177efb02afeaec3e02893e
1 file changed +101
Dothem new
+101
@@ -0,0 +1,101 @@
1 +#!/bin/sh
2 +
3 +: ${J=-j2}
4 +: ${BUILDBASE=../buildfarm}
5 +: ${branches='next master maint pu jch'}
6 +
7 +force= with_dash= M= install=
8 +while case "$1" in
9 + -pedantic) M=$1 ;;
10 + -force) force=$1 ;;
11 + -dash) with_dash=y ;;
12 + -noinstall) install=noinstall ;;
13 + *) break ;;
14 + esac
15 +do
16 + shift
17 +done
18 +test -f /bin/dash || with_dash=
19 +
20 +for branch in $branches
21 +do
22 + echo "** $branch **"
23 + revision=$(git show-ref -s --verify "refs/heads/$branch") || {
24 + echo "** No $branch"
25 + continue
26 + }
27 + test -d "$BUILDBASE/$branch" || {
28 + echo "** No $BUILDBASE/$branch"
29 + continue
30 + }
31 +
32 + private=$(git rev-parse -q --verify private-$branch 2>/dev/null)
33 + case $? in 0|1) ;; *) exit $? ;; esac
34 +
35 + if installed=$($HOME/git-$branch/bin/git version) &&
36 + if version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$')
37 + then
38 + :
39 + elif version=v$(expr "$installed" : \
40 + 'git version \(.*\)\.rc[0-9]*$')
41 + then
42 + version="$version"-$(expr "$installed" : \
43 + 'git version .*\.\(rc[0-9]*\)$')
44 + else
45 + version=v$(expr "$installed" : 'git version \(.*\)')
46 + fi &&
47 + version=$(git rev-parse --verify "$version^0" 2>/dev/null) &&
48 + test "z$version" = "z$revision"
49 + then
50 + echo "* up-to-date version \"$installed\" is already installed from $branch"
51 + test -n "$force" || continue
52 + fi
53 +
54 + echo "** $branch" &&
55 +
56 + (
57 + cd "$BUILDBASE/$branch"
58 + git checkout "$branch" &&
59 + git reset --hard || exit
60 + case "$private" in
61 + '')
62 + ;;
63 + ?*)
64 + git merge --squash --no-commit "$private" || {
65 + echo >&2 "Cannot apply private edition changes"
66 + git reset --hard
67 + }
68 + ;;
69 + esac &&
70 +
71 + case "$with_dash" in
72 + y)
73 + case "$branch" in
74 + master | maint | next | jch)
75 + Meta/Make $M -- $J SHELL_PATH=/bin/dash test
76 + ;;
77 + esac
78 + ;;
79 + esac &&
80 +
81 + Meta/Make $M -- $J all &&
82 + Meta/Make $M -- $J test &&
83 + case "$branch" in
84 + master | maint | next )
85 + Meta/Make $M -- doc
86 + ;;
87 + jch )
88 + Meta/Make $M -- doc install-doc
89 + ;;
90 + *)
91 + : ;;
92 + esac &&
93 + {
94 + test z$install = znoinstall ||
95 + Meta/Make $M -- install
96 + } || exit $?
97 +
98 + git reset --hard
99 + ) || break;
100 +
101 +done