Meta/ML (merge later)

Junio C Hamano committed Feb 10, 2012 at 15:05 UTC 6aeddc14ba1c0993268ccbfa16c6864e328d47a9
1 file changed +63
ML new
+63
@@ -0,0 +1,63 @@
1 +#!/bin/sh
2 +# Merge later...
3 +
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"
9 +
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
15 + do
16 + if ! full_sha1=$(git rev-parse --verify "$sha1")
17 + then
18 + echo >&2 "Not found: $sha1 $topic"
19 + continue
20 + fi
21 +
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
33 + fi
34 + ago=
35 + fp=$(
36 + sed -ne "s/^\($x40\) $x40 $tip"'$/\1/p' "$tmp"
37 + ) &&
38 + ago=$(
39 + git show -s --format='%ar' $fp
40 + )
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}"
47 + fi
48 + done
49 +}
50 +
51 +case $# in
52 +0)
53 + search_topics
54 + exit $?
55 + ;;
56 +esac
57 +
58 +for topic
59 +do
60 + sha1=$(git rev-parse --short $topic)
61 + echo " (merge $sha1 $topic later to maint)."
62 +done
63 +