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
--always $branch)
62 echo "$(git show -s --format='%ct' "$branch") $branch ;# $d"
65 sed -e 's/^[0-9]* //' \
66 -e 's/^/git branch -d /' |
69 cat "$tmp.known" "$tmp.both" |
sort >"$tmp.next"
70 mv "$tmp.next" "$tmp.known"
74 comm -13 "$tmp.maint" "$tmp.master" |
78 t
=$
(find_last_tip
$topic master
) &&
80 m
=$
(git rev-parse
--verify "$t^1") &&
81 test -n "$m" ||
continue
83 # NEEDSWORK: this misses repeated merges
89 # ---o---o---*---*---master
91 tsize
=$
(git rev-list
"$m..$topic" |
wc -l)
92 rsize
=$
(git rev-list
"maint..$topic" |
wc -l)
94 if test $tsize -eq $rsize
96 s
=$
(git show
-s --pretty="tformat:%ct %H" $t)
99 s
=$
(git show
-s --pretty="tformat:%ct %H" $t)
102 done 3>"$tmp.unmergeable" >"$tmp.mergeable"
104 if test -s "$tmp.unmergeable"
106 echo ": # Graduated to master; unmergeable to maint"
107 sort -n "$tmp.unmergeable" |
108 while read timestamp merge topic
110 git show
-s --pretty="format:: # %h %cd" $merge
111 echo "git branch -d $topic"
115 if test -s "$tmp.mergeable"
117 sort -n "$tmp.mergeable" |
118 while read timestamp merge topic
121 git show
-s --pretty="format:%h %cd" $merge
122 git log
--pretty=oneline
--abbrev-commit maint..
$topic
126 these
=$
(git rev-list maint..
$topic)
127 for m
in $old_maint maint
129 those
=$
(git rev-list
$m..
$topic)
130 if test "z$these" = "z$those"
137 echo "git checkout $maint && git merge $topic"