Meta/Reintegrate: redo the rerere part
[git/jnareb-git.git] / ML
blob4aa88893d791d5b05e1288fd719f590b9cbdaeb6
1 #!/bin/sh
2 # Merge later...
4 # Read from RelNotes and find mergeable topics
5 search_topics () {
6 tmp=/tmp/ML.$$
7 trap 'rm -f "$tmp"' 0
8 git rev-list --parents --first-parent maint..master >"$tmp"
10 x40='[0-9a-f]'
11 x40="$x40$x40$x40$x40$x40"
12 x40="$x40$x40$x40$x40$x40$x40$x40$x40"
13 sed -n -e 's/^ (merge \([0-9a-f]*\) \([^ ]*\) later to maint.*/\1 \2/p' |
14 while read sha1 topic
16 if ! full_sha1=$(git rev-parse --verify "$sha1")
17 then
18 echo >&2 "Not found: $sha1 $topic"
19 continue
22 comment=
23 if ! git show-ref --quiet --verify "refs/heads/$topic" &&
24 test $(git log --oneline maint..$full_sha1 | wc -l) != 0
25 then
26 comment="$topic gone"
27 tip=$full_sha1 topic=$sha1
28 elif tip=$(git rev-parse --verify "refs/heads/$topic") &&
29 test "$tip" != "$full_sha1"
30 then
31 echo >&2 "$tip moved from $sha1"
32 continue
34 ago=
35 fp=$(
36 sed -ne "s/^\($x40\) $x40 $tip"'$/\1/p' "$tmp"
37 ) &&
38 ago=$(
39 git show -s --format='%ar' $fp
41 lg=$(git log --oneline maint..$tip | wc -l)
42 if test $lg != 0
43 then
44 echo "$topic # $lg${ago+ ($ago)}${comment+ $comment}"
45 else
46 echo "# $topic already merged${ago+ ($ago)}${comment+ $comment}"
48 done
51 case $# in
53 search_topics
54 exit $?
56 esac
58 for topic
60 sha1=$(git rev-parse --short $topic)
61 echo " (merge $sha1 $topic later to maint)."
62 done