Add Meta/Reintegrate
[git/spearce.git] / Reintegrate
blobdfdb73ed9f72f4836f93651d7b7dada79ca84cc7
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 "") git merge "$branch" || break ;;
14 ?*) echo >&2 "Eh? $branch $eh"; break ;;
15 esac
16 done <<EOF'
18 git log --pretty=oneline --first-parent "$1" |
20 series=
21 while read commit msg
23 other=$(git rev-parse --verify "$commit^2") &&
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"
32 if test -z "$series"
33 then
34 series="$merged"
35 else
36 series="$merged$LF$series"
38 done
39 echo "$series"
42 echo 'EOF'