Meta/dodoc.sh: make it easier to relocate the build areas
[alt-git.git] / ML
blob8a3c2de328ed0ba07b03bc47af08070f83766f3b
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 test $(git log --oneline $target..$full_sha1 | wc -l) != 0
27 then
28 comment="$topic gone"
29 tip=$full_sha1 topic=$sha1
30 elif tip=$(git rev-parse --verify "refs/heads/$topic") &&
31 test "$tip" != "$full_sha1"
32 then
33 echo >&2 "$tip moved from $sha1"
34 continue
36 ago=
37 fp=$(
38 sed -ne "s/^\($x40\) $x40 $tip"'$/\1/p' "$tmp"
39 ) &&
40 ago=$(
41 git show -s --format='%ar' $fp
43 lg=$(git log --oneline $target..$tip | wc -l)
44 if test $lg != 0
45 then
46 echo "$topic # $lg${ago+ ($ago)}${comment+ $comment}"
47 else
48 echo "# $topic already merged${ago+ ($ago)}${comment+ $comment}"
50 done
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
62 shift ;;
64 break ;;
65 esac
67 shift
68 done
70 case $# in
72 search_topics
73 exit $?
75 esac
77 for topic
79 sha1=$(git rev-parse --short $topic)
80 echo " (merge $sha1 $topic later to maint)."
81 done