Meta/ML: allow target other than maint

Junio C Hamano committed Apr 12, 2012 at 15:38 UTC 016bdeca29a96dbc5951b0a5f3349ffff16b83f2
1 file changed +23 -4
ML
+23 -4
@@ -1,11 +1,13 @@
1 #!/bin/sh
2 # Merge later...
3
4 +target=maint
5 +
6 # Read from RelNotes and find mergeable topics
7 search_topics () {
8 tmp=/tmp/ML.$$
9 trap 'rm -f "$tmp"' 0
8 - git rev-list --parents --first-parent maint..master >"$tmp"
10 + git rev-list --parents --first-parent $target..master >"$tmp"
11
12 x40='[0-9a-f]'
13 x40="$x40$x40$x40$x40$x40"
@@ -20,8 +22,8 @@ search_topics () {
22 fi
23
24 comment=
23 - if ! git show-ref --quiet --verify "refs/heads/$topic" &&
24 - test $(git log --oneline maint..$full_sha1 | wc -l) != 0
25 + if ! git show-ref --quiet --verify "refs/heads/$topic" ||
26 + test $(git log --oneline $target..$full_sha1 | wc -l) != 0
27 then
28 comment="$topic gone"
29 tip=$full_sha1 topic=$sha1
@@ -38,7 +40,7 @@ search_topics () {
40 ago=$(
41 git show -s --format='%ar' $fp
42 )
41 - lg=$(git log --oneline maint..$tip | wc -l)
43 + lg=$(git log --oneline $target..$tip | wc -l)
44 if test $lg != 0
45 then
46 echo "$topic # $lg${ago+ ($ago)}${comment+ $comment}"
@@ -48,6 +50,23 @@ search_topics () {
50 done
51 }
52
53 +while case "$#,$1" in
54 + 0,*)
55 + break ;;
56 + *,-t)
57 + target=${2?"-t target???"}
58 + git show-ref --quiet --verify "refs/heads/$target" || {
59 + echo >&2 "$target: no such branch"
60 + exit 1
61 + }
62 + shift ;;
63 + *)
64 + break ;;
65 + esac
66 +do
67 + shift
68 +done
69 +
70 case $# in
71 0)
72 search_topics