Meta/MaintNotes: post 2.4 update
[git.git] / PU
blob2a7f00b0a65cef0f1f8f6d46d490942fcbaf69a4
1 #!/bin/sh
3 # Rebuild "pu" from topic branches.
6 git update-index --refresh || exit
7 case "$(git diff-index --name-status HEAD)" in
8 '') ;;
9 *) echo 2>&1 "Local modifications exist."
10 exit 1;;
11 esac
13 case "$1" in
14 --continue)
15 shift
18 git checkout pu &&
19 git reset --hard master || exit
20 esac
21 ORIG_HEAD=`git rev-parse ORIG_HEAD` || exit
22 LF='
25 case "$#" in
27 # interactive ;-)
28 shift
29 HH=`cd .git/refs/heads && find -type f |
30 sed -e 's/^\.\///' \
31 -e '/^naster$/d' -e '/^master$/d' -e '/^maint$/d' -e '/^pu$/d'`
32 while test "$HH"
34 I=0
35 echo "0: done"
36 NHH=
37 for H in $HH
39 HSHA1=`git rev-parse --verify $H` || continue
40 MB=`git show-branch --merge-base pu $HSHA1`
41 case "$LF$MB$LF" in
42 *"$LF$HSHA1$LF"*) continue ;; # already merged.
43 esac
44 I=$(($I+1))
45 echo -n "$I: "
46 git show-branch $H
47 NHH="${NHH}$H "
48 done
49 case "$I" in
51 break ;;
52 esac
53 HH=$NHH
54 echo -n "Merge which ones (0 to finish)? "
55 read ans
56 case "$ans" in
57 '' | 0)
58 break ;;
59 esac
60 I=0
61 UNUSE= USE= USED=
62 for H in $HH
64 I=$(($I+1))
65 case " $ans " in
66 *' '$I' '*)
67 USE="$USE$H "
68 USED="$USED,$H"
71 UNUSE="$UNUSE$H "
73 esac
74 done
75 USED=`expr "$USED" : ',\(.*\)'`
76 git pull -n . $USE || exit
77 # git merge -n "Merge $USED" pu $USE || exit
78 HH=$UNUSE
79 done
80 exit
82 esac
84 for H
86 # (IFS=",$IFS"; git merge -n "Merge $H" pu $H) || exit
87 (IFS=",$IFS"; git pull -n . $H) || exit
88 done
90 (IFS=",$IFS"; git show-branch master $* pu `git rev-parse --short $ORIG_HEAD`)