Adjust for RPM rename.
[git.git] / PU
1 #!/bin/sh
2 #
3 # Rebuild "pu" from topic branches.
4 #
5
6 git status && exit
7 git checkout pu &&
8 git reset --hard master &&
9 ORIG_HEAD=`git rev-parse ORIG_HEAD` || exit
10
11 case "$#" in
12 0)
13         # interactive ;-)
14         shift
15         HH=`cd .git/refs/heads && find -type f |
16         sed -e 's/^\.\///' -e '/^master$/d' -e '/^maint$/d' -e '/^pu$/d'`
17         while test "$HH"
18         do
19                 I=0
20                 echo "0: done"
21                 for H in $HH
22                 do
23                         I=$(($I+1))
24                         echo -n "$I: "
25                         git-show-branch $H
26                 done
27                 echo -n "Merge which ones (0 to finish)? "
28                 read ans
29                 case "$ans" in
30                 '' | 0)
31                         break ;;
32                 esac
33                 I=0
34                 UNUSE=
35                 USE=
36                 for H in $HH
37                 do
38                         I=$(($I+1))
39                         case " $ans " in
40                         *' '$I' '*)
41                                 USE="$USE$H "
42                                 ;;
43                         *)
44                                 UNUSE="$UNUSE$H "
45                                 ;;
46                         esac
47                 done
48                 git pull -n . $USE || exit
49                 HH=$UNUSE
50         done
51         exit
52         ;;
53 esac
54
55 for H
56 do
57         (IFS=",$IFS"; git pull -n . $H) || exit
58 done
59
60 (IFS=",$IFS"; git show-branch master pu $* $ORIG_HEAD)