Remove bunch of stale issues - the list is unmaintained these days
[git/spearce.git] / GRADUATED
blob01ee411a3f0aebcf3a0519d16085ac6b97dcb733
1 #!/bin/sh
3 _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
4 _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
5 LF='
8 # disable pager
9 GIT_PAGER=cat
10 export GIT_PAGER
12 find_last_tip () {
13 topic="$(git rev-parse --verify "$1")" integrate="$2"
14 git rev-list --first-parent --parents "$2" |
15 sed -n -e "
16 /^$_x40 $_x40 $topic$/{
17 s/^\($_x40\) $_x40 $topic$/\1/p
24 tmp=/tmp/GR.$$
26 trap 'rm -f "$tmp".*' 0
28 git branch --merged master | sed -n -e '/\//s/^. //p' >"$tmp.master"
29 git branch --merged maint | sed -n -e '/\//s/^. //p' >"$tmp.maint"
31 comm -12 "$tmp.maint" "$tmp.master" >"$tmp.both"
32 if test -s "$tmp.both"
33 then
34 echo "# Graduated to both maint and master"
35 sed -e 's|^|git branch -d |' "$tmp.both"
36 echo
39 comm -13 "$tmp.maint" "$tmp.master" |
41 while read topic
43 t=$(find_last_tip $topic master) &&
44 test -n "$t" &&
45 m=$(git rev-parse --verify "$t^1") &&
46 test -n "$m" || continue
48 # NEEDSWORK: this misses repeated merges
50 # o---o---maint
51 # /
52 # .---o---o topic
53 # / \ \
54 # ---o---o---*---*---master
56 tsize=$(git rev-list "$m..$topic" | wc -l)
57 rsize=$(git rev-list "maint..$topic" | wc -l)
59 if test $tsize -eq $rsize
60 then
61 s=$(git show -s --pretty="tformat:%ct %H" $t)
62 echo "$s $topic"
63 else
64 s=$(git show -s --pretty="tformat:%ct %H" $t)
65 echo >&3 "$s $topic"
67 done 3>"$tmp.unmergeable" >"$tmp.mergeable"
69 if test -s "$tmp.unmergeable"
70 then
71 echo "# Graduated to master; unmergeable to maint"
72 sort -n "$tmp.unmergeable" |
73 while read timestamp merge topic
75 git show -s --pretty="format:# %h %cd" $merge
76 echo "git branch -d $topic"
77 done
78 echo
80 if test -s "$tmp.mergeable"
81 then
82 sort -n "$tmp.mergeable" |
83 while read timestamp merge topic
86 git show -s --pretty="format:%h %cd" $merge
87 git log --pretty=oneline --abbrev-commit maint..$topic
88 } |
89 sed -e 's/^/# /'
90 echo "git checkout maint && git merge $topic"
91 echo
92 done