5 git for-each-ref
--format='%(refname)' 'refs/heads/maint-*' |
6 sed -e 's|^refs/heads/||'
9 _x40
='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
10 _x40
="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
19 topic
="$(git rev-parse --verify "$1")" integrate
="$2"
20 git rev-list
--first-parent --parents "$2" |
22 /^$_x40 $_x40 $topic$/{
23 s/^\($_x40\) $_x40 $topic$/\1/p
32 trap 'rm -f "$tmp".*' 0
34 git branch
--merged master |
sed -n -e '/\//s/^. //p' |
sort >"$tmp.master"
37 for m
in $old_maint maint
39 git branch
--merged $m |
sed -n -e '/\//s/^. //p' |
sort >"$tmp.$m"
40 comm -12 "$tmp.$m" "$tmp.master" >"$tmp.both0"
41 comm -23 "$tmp.both0" "$tmp.known" >"$tmp.both"
42 if test -s "$tmp.both"
44 echo "# Graduated to both $m and master"
47 d
=$
(git describe
$branch)
48 echo "$(git show -s --format='%ct' "$branch") $branch ;# $d"
51 sed -e 's/^[0-9]* //' \
52 -e 's/^/git branch -d /'
54 cat "$tmp.known" "$tmp.both" |
sort >"$tmp.next"
55 mv "$tmp.next" "$tmp.known"
59 comm -13 "$tmp.maint" "$tmp.master" |
63 t
=$
(find_last_tip
$topic master
) &&
65 m
=$
(git rev-parse
--verify "$t^1") &&
66 test -n "$m" ||
continue
68 # NEEDSWORK: this misses repeated merges
74 # ---o---o---*---*---master
76 tsize
=$
(git rev-list
"$m..$topic" |
wc -l)
77 rsize
=$
(git rev-list
"maint..$topic" |
wc -l)
79 if test $tsize -eq $rsize
81 s
=$
(git show
-s --pretty="tformat:%ct %H" $t)
84 s
=$
(git show
-s --pretty="tformat:%ct %H" $t)
87 done 3>"$tmp.unmergeable" >"$tmp.mergeable"
89 if test -s "$tmp.unmergeable"
91 echo ": # Graduated to master; unmergeable to maint"
92 sort -n "$tmp.unmergeable" |
93 while read timestamp merge topic
95 git show
-s --pretty="format:: # %h %cd" $merge
96 echo "git branch -d $topic"
100 if test -s "$tmp.mergeable"
102 sort -n "$tmp.mergeable" |
103 while read timestamp merge topic
106 git show
-s --pretty="format:%h %cd" $merge
107 git log
--pretty=oneline
--abbrev-commit maint..
$topic
110 echo "git checkout maint && git merge $topic"