What's cooking (2013/01 #05)
[alt-git.git] / ML
blobf8376cd2afd7a1c4d28e28713b9656d29cac49ba
1 #!/bin/sh
2 # Merge later...
4 target=maint
6 # Read from RelNotes and find mergeable topics
7 search_topics () {
8 tmp=/tmp/ML.$$
9 trap 'rm -f "$tmp"' 0
10 git rev-list --parents --first-parent $target..master >"$tmp"
12 x40='[0-9a-f]'
13 x40="$x40$x40$x40$x40$x40"
14 x40="$x40$x40$x40$x40$x40$x40$x40$x40"
15 sed -n -e 's/^ (merge \([0-9a-f]*\) \([^ ]*\) later to maint.*/\1 \2/p' |
16 while read sha1 topic
18 if ! full_sha1=$(git rev-parse --verify "$sha1")
19 then
20 echo >&2 "Not found: $sha1 $topic"
21 continue
24 comment=
25 if ! git show-ref --quiet --verify "refs/heads/$topic"
26 then
27 comment="$topic gone"
28 tip=$full_sha1 topic=$sha1
29 elif tip=$(git rev-parse --verify "refs/heads/$topic") &&
30 test "$tip" != "$full_sha1"
31 then
32 echo >&2 "$topic # $tip moved from $sha1"
33 continue
36 ago= lg=0
37 fp=$(
38 sed -ne "s/^\($x40\) $x40 $tip"'$/\1/p' "$tmp"
39 ) &&
40 test -n "$fp" &&
41 ago=$(
42 git show -s --format='%ar' $fp
43 ) &&
44 lg=$(git log --oneline $target..$tip | wc -l)
45 if test $lg != 0
46 then
47 echo "$topic # $lg${ago+ ($ago)}${comment+ $comment}"
48 else
49 echo "# $topic already merged${ago+ ($ago)}${comment+ $comment}"
51 done
54 while case "$#,$1" in
55 0,*)
56 break ;;
57 *,-t)
58 target=${2?"-t target???"}
59 git show-ref --quiet --verify "refs/heads/$target" || {
60 echo >&2 "$target: no such branch"
61 exit 1
63 shift ;;
65 break ;;
66 esac
68 shift
69 done
71 case $# in
73 search_topics
74 exit $?
76 esac
78 for topic
80 sha1=$(git rev-parse --short $topic)
81 echo " (merge $sha1 $topic later to maint)."
82 done