What's in
[git/spearce.git] / Reintegrate
blob0b56201d86f6b0c9ddb9ebca2d3a1481d39c9842
1 #!/bin/sh
3 merge_msg="Merge branch '\(.*\)'"
4 x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
5 x40="$x40$x40$x40$x40$x40$x40$x40$x40"
6 LF='
9 echo '#!/bin/sh
10 while read branch eh
12 case "$eh" in
13 "")
14 echo >&2 "* $branch"
15 git merge "$branch" || break ;;
16 pick" "*)
17 echo >&2 "* $eh"
18 git cherry-pick "$branch" || break ;;
19 *) echo >&2 "Eh? $branch $eh"; break ;;
20 esac
21 done <<EOF'
23 show_merge () {
24 branch=$(expr "$msg" : "$merge_msg") &&
25 tip=$(git rev-parse --verify "refs/heads/$branch" 2>/dev/null) &&
26 merged=$(git name-rev --refs="refs/heads/$branch" "$other" 2>/dev/null) &&
27 merged=$(expr "$merged" : "$x40 \(.*\)") &&
28 test "$merged" != undefined || {
29 other=$(git log -1 --pretty='format:%s' $other) &&
30 merged="$branch :rebased? $other"
34 show_pick () {
35 merged="$(git rev-parse --verify "$commit") pick $msg"
38 git log --pretty=oneline --first-parent "$1" |
40 series=
41 while read commit msg
43 if other=$(git rev-parse -q --verify "$commit^2")
44 then
45 show_merge
46 else
47 show_pick
50 if test -z "$series"
51 then
52 series="$merged"
53 else
54 series="$merged$LF$series"
56 done
57 echo "$series"
60 echo 'EOF'