4 old_maint
='maint-1.6.0 maint-1.6.1'
6 _x40
='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
7 _x40
="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
16 topic
="$(git rev-parse --verify "$1")" integrate
="$2"
17 git rev-list
--first-parent --parents "$2" |
19 /^$_x40 $_x40 $topic$/{
20 s/^\($_x40\) $_x40 $topic$/\1/p
29 trap 'rm -f "$tmp".*' 0
31 git branch
--merged master |
sed -n -e '/\//s/^. //p' |
sort >"$tmp.master"
34 for m
in $old_maint maint
36 git branch
--merged $m |
sed -n -e '/\//s/^. //p' |
sort >"$tmp.$m"
37 comm -12 "$tmp.$m" "$tmp.master" >"$tmp.both0"
38 comm -23 "$tmp.both0" "$tmp.known" >"$tmp.both"
39 if test -s "$tmp.both"
41 echo "# Graduated to both $m and master"
44 echo "$(git show -s --format='%ct' "$branch") $branch"
47 sed -e 's/^[0-9]* //' \
48 -e 's/^/git branch -d /'
50 cat "$tmp.known" "$tmp.both" |
sort >"$tmp.next"
51 mv "$tmp.next" "$tmp.known"
55 comm -13 "$tmp.maint" "$tmp.master" |
59 t
=$
(find_last_tip
$topic master
) &&
61 m
=$
(git rev-parse
--verify "$t^1") &&
62 test -n "$m" ||
continue
64 # NEEDSWORK: this misses repeated merges
70 # ---o---o---*---*---master
72 tsize
=$
(git rev-list
"$m..$topic" |
wc -l)
73 rsize
=$
(git rev-list
"maint..$topic" |
wc -l)
75 if test $tsize -eq $rsize
77 s
=$
(git show
-s --pretty="tformat:%ct %H" $t)
80 s
=$
(git show
-s --pretty="tformat:%ct %H" $t)
83 done 3>"$tmp.unmergeable" >"$tmp.mergeable"
85 if test -s "$tmp.unmergeable"
87 echo "# Graduated to master; unmergeable to maint"
88 sort -n "$tmp.unmergeable" |
89 while read timestamp merge topic
91 git show
-s --pretty="format:# %h %cd" $merge
92 echo "git branch -d $topic"
96 if test -s "$tmp.mergeable"
98 sort -n "$tmp.mergeable" |
99 while read timestamp merge topic
102 git show
-s --pretty="format:%h %cd" $merge
103 git log
--pretty=oneline
--abbrev-commit maint..
$topic
106 echo "git checkout maint && git merge $topic"