5 git for-each-ref
--format='%(refname)' 'refs/heads/maint-*' |
6 sed -e 's|^refs/heads/||'
9 # Are older maint branches all included in newer ones?
10 and_or_thru
=thru prev
=
11 for m
in $old_maint maint
15 test "$(git rev-list $m..$prev | wc -l)" = 0 ||
{
23 _x40
='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
24 _x40
="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
33 topic
="$(git rev-parse --verify "$1")" integrate
="$2"
34 git rev-list
--first-parent --parents "$2" |
36 /^$_x40 $_x40 $topic$/{
37 s/^\($_x40\) $_x40 $topic$/\1/p
46 trap 'rm -f "$tmp".*' 0
48 git branch
--merged master |
sed -n -e '/\//s/^. //p' |
sort >"$tmp.master"
51 for m
in $old_maint maint
53 git branch
--merged $m |
sed -n -e '/\//s/^. //p' |
sort >"$tmp.$m"
54 comm -12 "$tmp.$m" "$tmp.master" >"$tmp.both0"
55 comm -23 "$tmp.both0" "$tmp.known" >"$tmp.both"
56 if test -s "$tmp.both"
58 echo "# Graduated to both $m $and_or_thru master"
61 d
=$
(git describe
$branch)
62 echo "$(git show -s --format='%ct' "$branch") $branch ;# $d"
65 sed -e 's/^[0-9]* //' \
66 -e 's/^/git branch -d /'
68 cat "$tmp.known" "$tmp.both" |
sort >"$tmp.next"
69 mv "$tmp.next" "$tmp.known"
73 comm -13 "$tmp.maint" "$tmp.master" |
77 t
=$
(find_last_tip
$topic master
) &&
79 m
=$
(git rev-parse
--verify "$t^1") &&
80 test -n "$m" ||
continue
82 # NEEDSWORK: this misses repeated merges
88 # ---o---o---*---*---master
90 tsize
=$
(git rev-list
"$m..$topic" |
wc -l)
91 rsize
=$
(git rev-list
"maint..$topic" |
wc -l)
93 if test $tsize -eq $rsize
95 s
=$
(git show
-s --pretty="tformat:%ct %H" $t)
98 s
=$
(git show
-s --pretty="tformat:%ct %H" $t)
101 done 3>"$tmp.unmergeable" >"$tmp.mergeable"
103 if test -s "$tmp.unmergeable"
105 echo ": # Graduated to master; unmergeable to maint"
106 sort -n "$tmp.unmergeable" |
107 while read timestamp merge topic
109 git show
-s --pretty="format:: # %h %cd" $merge
110 echo "git branch -d $topic"
114 if test -s "$tmp.mergeable"
116 sort -n "$tmp.mergeable" |
117 while read timestamp merge topic
120 git show
-s --pretty="format:%h %cd" $merge
121 git log
--pretty=oneline
--abbrev-commit maint..
$topic
125 these
=$
(git rev-list maint..
$topic)
126 for m
in $old_maint maint
128 those
=$
(git rev-list
$m..
$topic)
129 if test "z$these" = "z$those"
136 echo "git checkout $maint && git merge $topic"